From c1259d23980bbfb5cba6d63b14b52b81fb2ee052 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Wed, 30 Sep 2026 22:33:26 +0000 Subject: [PATCH 1/5] Point at found impl in "not general enough" ``` error: implementation of `TheTrait` is not general enough --> $DIR/associated-types-eq-hr.rs:96:5 | LL | fn tuple_one() | --------- due to a where-clause on `tuple_one`... LL | where LL | T: for<'x, 'y> TheTrait<(&'x isize, &'y isize), A = &'x isize>, | ----------------------------------------------------------- unsatisfied where-clause on `tuple_one` ... LL | tuple_one::(); | ^^^^^^^^^^^^^^^^^^^^ | = note: ...`Tuple` must implement `TheTrait<(&'0 isize, &'1 isize)>`, for any two lifetimes `'0` and `'1`... note: ...but it actually implements `TheTrait<(&'2 isize, &'2 isize)>`, for some specific lifetime `'2` --> $DIR/associated-types-eq-hr.rs:35:1 | LL | impl<'a> TheTrait<(&'a isize, &'a isize)> for Tuple { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ``` --- compiler/rustc_error_messages/src/lib.rs | 6 +++ .../src/diagnostics/subdiagnostic.rs | 2 +- .../rustc_trait_selection/src/diagnostics.rs | 2 + .../nice_region_error/placeholder_error.rs | 16 ++++++- .../src/error_reporting/traits/ambiguity.rs | 7 ++- .../traits/fulfillment_errors.rs | 23 +++++---- .../src/error_reporting/traits/mod.rs | 2 +- .../src/error_reporting/traits/suggestions.rs | 5 +- .../associated-types-eq-hr.stderr | 48 +++++++++++++++---- ...n-with-leaking-placeholders.current.stderr | 6 ++- .../trait-bounds/hrtb-conflate-regions.stderr | 12 ++++- ...b-exists-forall-trait-contravariant.stderr | 6 ++- .../hrtb-exists-forall-trait-covariant.stderr | 6 ++- .../hrtb-exists-forall-trait-invariant.stderr | 6 ++- .../trait-bounds/hrtb-just-for-static.stderr | 6 ++- .../hrtb-perfect-forwarding.stderr | 6 ++- tests/ui/impl-trait/nested-rpit-hrtb.stderr | 6 ++- 17 files changed, 134 insertions(+), 31 deletions(-) diff --git a/compiler/rustc_error_messages/src/lib.rs b/compiler/rustc_error_messages/src/lib.rs index cb3b43aafa155..881f11ff17b0a 100644 --- a/compiler/rustc_error_messages/src/lib.rs +++ b/compiler/rustc_error_messages/src/lib.rs @@ -216,6 +216,12 @@ impl From for MultiSpan { } } +impl From> for MultiSpan { + fn from(span: Option) -> MultiSpan { + MultiSpan::from_spans(span.into_iter().collect()) + } +} + impl From> for MultiSpan { fn from(spans: Vec) -> MultiSpan { MultiSpan::from_spans(spans) diff --git a/compiler/rustc_macros/src/diagnostics/subdiagnostic.rs b/compiler/rustc_macros/src/diagnostics/subdiagnostic.rs index baf38d2fc381f..058d93e83719a 100644 --- a/compiler/rustc_macros/src/diagnostics/subdiagnostic.rs +++ b/compiler/rustc_macros/src/diagnostics/subdiagnostic.rs @@ -315,7 +315,7 @@ impl<'parent, 'a> SubdiagnosticDeriveVariantBuilder<'parent, 'a> { let binding = info.binding.binding.clone(); // FIXME(#100717): support `Option` on `primary_span` like in the // diagnostic derive - if !matches!(info.ty, FieldInnerTy::Plain(_)) { + if !matches!(info.ty, FieldInnerTy::Plain(_) | FieldInnerTy::Option(_)) { throw_invalid_attr!(attr, |diag| { let diag = diag.note("there must be exactly one primary span"); diff --git a/compiler/rustc_trait_selection/src/diagnostics.rs b/compiler/rustc_trait_selection/src/diagnostics.rs index 1b597583d53fc..917f2e83c2282 100644 --- a/compiler/rustc_trait_selection/src/diagnostics.rs +++ b/compiler/rustc_trait_selection/src/diagnostics.rs @@ -1052,6 +1052,8 @@ pub(crate) enum ActualImplExplNotes<'tcx> { trait_path: Highlighted<'tcx, TraitRefPrintOnlyTraitPath<'tcx>>, has_lifetime: bool, lifetime: usize, + #[primary_span] + span: Option, }, #[note( "...but `{$trait_path}` is actually implemented for the type `{$ty}`{$has_lifetime -> diff --git a/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/placeholder_error.rs b/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/placeholder_error.rs index 390e21e34ef4c..07b4a142e4014 100644 --- a/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/placeholder_error.rs +++ b/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/placeholder_error.rs @@ -613,7 +613,21 @@ impl<'tcx> NiceRegionError<'_, 'tcx> { let lifetime = actual_has_vid.unwrap_or_default(); let note_2 = if same_self_type { - ActualImplExplNotes::ButActuallyImplementsTrait { trait_path, has_lifetime, lifetime } + let impl_candidates = self.cx.find_similar_impl_candidates( + actual_trait_ref.value.def_id, + actual_trait_ref.value.self_ty(), + ); + let span = if let [candidate] = impl_candidates { + Some(self.tcx().def_span(candidate.impl_def_id)) + } else { + None + }; + ActualImplExplNotes::ButActuallyImplementsTrait { + trait_path, + has_lifetime, + lifetime, + span, + } } else if passive_voice { ActualImplExplNotes::ButActuallyImplementedForTy { trait_path, diff --git a/compiler/rustc_trait_selection/src/error_reporting/traits/ambiguity.rs b/compiler/rustc_trait_selection/src/error_reporting/traits/ambiguity.rs index 05e1cb6210b50..2a3ddaa54aadd 100644 --- a/compiler/rustc_trait_selection/src/error_reporting/traits/ambiguity.rs +++ b/compiler/rustc_trait_selection/src/error_reporting/traits/ambiguity.rs @@ -361,8 +361,11 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { let pred = self.tcx.short_string(predicate, &mut err.long_ty_path()); err.note(format!("cannot satisfy `{pred}`")); } - let impl_candidates = - self.find_similar_impl_candidates(predicate.as_trait_clause().unwrap()); + let clause = predicate.as_trait_clause().unwrap(); + let impl_candidates = self.find_similar_impl_candidates( + clause.def_id(), + clause.self_ty().skip_binder(), + ); if impl_candidates.len() < 40 { self.report_similar_impl_candidates( impl_candidates.as_slice(), diff --git a/compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs b/compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs index ed0ecf459c3b8..3b21c5e5f19ba 100644 --- a/compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs +++ b/compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs @@ -2121,13 +2121,14 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { } } - pub(super) fn find_similar_impl_candidates( + pub(crate) fn find_similar_impl_candidates( &self, - trait_pred: ty::PolyTraitClause<'tcx>, + trait_def_id: DefId, + self_ty: Ty<'tcx>, ) -> Vec> { let mut candidates: Vec<_> = self .tcx - .all_impls(trait_pred.def_id()) + .all_impls(trait_def_id) .filter_map(|def_id| { let imp = self.tcx.impl_trait_header(def_id); if imp.polarity != ty::ImplPolarity::Positive @@ -2137,9 +2138,9 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { } let imp = imp.trait_ref.skip_binder(); - self.fuzzy_match_tys(trait_pred.skip_binder().self_ty(), imp.self_ty(), false).map( - |similarity| ImplCandidate { trait_ref: imp, similarity, impl_def_id: def_id }, - ) + self.fuzzy_match_tys(self_ty, imp.self_ty(), false).map(|similarity| { + ImplCandidate { trait_ref: imp, similarity, impl_def_id: def_id } + }) }) .collect(); if candidates.iter().any(|c| matches!(c.similarity, CandidateSimilarity::Exact { .. })) { @@ -2772,7 +2773,10 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { // the user might expect to be presented with. Instead this is // useful for less general traits. if peeled && !self.tcx.trait_is_auto(def_id) && self.tcx.as_lang_item(def_id).is_none() { - let impl_candidates = self.find_similar_impl_candidates(trait_pred); + let impl_candidates = self.find_similar_impl_candidates( + trait_pred.def_id(), + trait_pred.self_ty().skip_binder(), + ); self.report_similar_impl_candidates( &impl_candidates, obligation, @@ -3475,7 +3479,10 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { ); } else if !suggested && trait_predicate.polarity() == ty::ClausePolarity::Positive { // Can't show anything else useful, try to find similar impls. - let impl_candidates = self.find_similar_impl_candidates(trait_predicate); + let impl_candidates = self.find_similar_impl_candidates( + trait_predicate.def_id(), + trait_predicate.self_ty().skip_binder(), + ); if !self.report_similar_impl_candidates( &impl_candidates, obligation, diff --git a/compiler/rustc_trait_selection/src/error_reporting/traits/mod.rs b/compiler/rustc_trait_selection/src/error_reporting/traits/mod.rs index a7a907e8f4d94..1a661270a5d5d 100644 --- a/compiler/rustc_trait_selection/src/error_reporting/traits/mod.rs +++ b/compiler/rustc_trait_selection/src/error_reporting/traits/mod.rs @@ -45,7 +45,7 @@ pub enum CandidateSimilarity { pub struct ImplCandidate<'tcx> { pub trait_ref: ty::TraitRef<'tcx>, pub similarity: CandidateSimilarity, - impl_def_id: DefId, + pub impl_def_id: DefId, } enum GetSafeTransmuteErrorAndReason { diff --git a/compiler/rustc_trait_selection/src/error_reporting/traits/suggestions.rs b/compiler/rustc_trait_selection/src/error_reporting/traits/suggestions.rs index 9219c709eee83..76755eb481db7 100644 --- a/compiler/rustc_trait_selection/src/error_reporting/traits/suggestions.rs +++ b/compiler/rustc_trait_selection/src/error_reporting/traits/suggestions.rs @@ -1245,7 +1245,10 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { main_trait_predicate: ty::PolyTraitClause<'tcx>, span: Span, ) -> bool { - let &[candidate] = &self.find_similar_impl_candidates(leaf_trait_predicate)[..] else { + let &[candidate] = &self.find_similar_impl_candidates( + leaf_trait_predicate.def_id(), + leaf_trait_predicate.self_ty().skip_binder(), + )[..] else { return false; }; let candidate = candidate.trait_ref; diff --git a/tests/ui/associated-types/associated-types-eq-hr.stderr b/tests/ui/associated-types/associated-types-eq-hr.stderr index 70596cbab1225..4a24b75700b8b 100644 --- a/tests/ui/associated-types/associated-types-eq-hr.stderr +++ b/tests/ui/associated-types/associated-types-eq-hr.stderr @@ -53,7 +53,11 @@ LL | tuple_one::(); | ^^^^^^^^^^^^^^^^^^^^ | = note: ...`Tuple` must implement `TheTrait<(&'0 isize, &'1 isize)>`, for any two lifetimes `'0` and `'1`... - = note: ...but it actually implements `TheTrait<(&'2 isize, &'2 isize)>`, for some specific lifetime `'2` +note: ...but it actually implements `TheTrait<(&'2 isize, &'2 isize)>`, for some specific lifetime `'2` + --> $DIR/associated-types-eq-hr.rs:35:1 + | +LL | impl<'a> TheTrait<(&'a isize, &'a isize)> for Tuple { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: implementation of `TheTrait` is not general enough --> $DIR/associated-types-eq-hr.rs:96:5 @@ -68,7 +72,11 @@ LL | tuple_one::(); | ^^^^^^^^^^^^^^^^^^^^ | = note: ...`Tuple` must implement `TheTrait<(&'0 isize, &'1 isize)>`, for any two lifetimes `'0` and `'1`... - = note: ...but it actually implements `TheTrait<(&'2 isize, &'2 isize)>`, for some specific lifetime `'2` +note: ...but it actually implements `TheTrait<(&'2 isize, &'2 isize)>`, for some specific lifetime `'2` + --> $DIR/associated-types-eq-hr.rs:35:1 + | +LL | impl<'a> TheTrait<(&'a isize, &'a isize)> for Tuple { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: implementation of `TheTrait` is not general enough @@ -84,7 +92,11 @@ LL | tuple_one::(); | ^^^^^^^^^^^^^^^^^^^^ | = note: ...`Tuple` must implement `TheTrait<(&'0 isize, &'1 isize)>`, for any two lifetimes `'0` and `'1`... - = note: ...but it actually implements `TheTrait<(&'2 isize, &'2 isize)>`, for some specific lifetime `'2` +note: ...but it actually implements `TheTrait<(&'2 isize, &'2 isize)>`, for some specific lifetime `'2` + --> $DIR/associated-types-eq-hr.rs:35:1 + | +LL | impl<'a> TheTrait<(&'a isize, &'a isize)> for Tuple { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: implementation of `TheTrait` is not general enough --> $DIR/associated-types-eq-hr.rs:96:5 @@ -99,7 +111,11 @@ LL | tuple_one::(); | ^^^^^^^^^^^^^^^^^^^^ | = note: ...`Tuple` must implement `TheTrait<(&'0 isize, &'1 isize)>`, for any two lifetimes `'0` and `'1`... - = note: ...but it actually implements `TheTrait<(&'2 isize, &'2 isize)>`, for some specific lifetime `'2` +note: ...but it actually implements `TheTrait<(&'2 isize, &'2 isize)>`, for some specific lifetime `'2` + --> $DIR/associated-types-eq-hr.rs:35:1 + | +LL | impl<'a> TheTrait<(&'a isize, &'a isize)> for Tuple { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: implementation of `TheTrait` is not general enough @@ -115,7 +131,11 @@ LL | tuple_two::(); | ^^^^^^^^^^^^^^^^^^^^ | = note: ...`Tuple` must implement `TheTrait<(&'0 isize, &'1 isize)>`, for any two lifetimes `'0` and `'1`... - = note: ...but it actually implements `TheTrait<(&'2 isize, &'2 isize)>`, for some specific lifetime `'2` +note: ...but it actually implements `TheTrait<(&'2 isize, &'2 isize)>`, for some specific lifetime `'2` + --> $DIR/associated-types-eq-hr.rs:35:1 + | +LL | impl<'a> TheTrait<(&'a isize, &'a isize)> for Tuple { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: implementation of `TheTrait` is not general enough --> $DIR/associated-types-eq-hr.rs:104:5 @@ -130,7 +150,11 @@ LL | tuple_two::(); | ^^^^^^^^^^^^^^^^^^^^ | = note: ...`Tuple` must implement `TheTrait<(&'0 isize, &'1 isize)>`, for any two lifetimes `'0` and `'1`... - = note: ...but it actually implements `TheTrait<(&'2 isize, &'2 isize)>`, for some specific lifetime `'2` +note: ...but it actually implements `TheTrait<(&'2 isize, &'2 isize)>`, for some specific lifetime `'2` + --> $DIR/associated-types-eq-hr.rs:35:1 + | +LL | impl<'a> TheTrait<(&'a isize, &'a isize)> for Tuple { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error[E0308]: mismatched types @@ -175,7 +199,11 @@ LL | tuple_four::(); | ^^^^^^^^^^^^^^^^^^^^^ | = note: ...`Tuple` must implement `TheTrait<(&'0 isize, &'1 isize)>`, for any two lifetimes `'0` and `'1`... - = note: ...but it actually implements `TheTrait<(&'2 isize, &'2 isize)>`, for some specific lifetime `'2` +note: ...but it actually implements `TheTrait<(&'2 isize, &'2 isize)>`, for some specific lifetime `'2` + --> $DIR/associated-types-eq-hr.rs:35:1 + | +LL | impl<'a> TheTrait<(&'a isize, &'a isize)> for Tuple { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: implementation of `TheTrait` is not general enough --> $DIR/associated-types-eq-hr.rs:116:5 @@ -190,7 +218,11 @@ LL | tuple_four::(); | ^^^^^^^^^^^^^^^^^^^^^ | = note: ...`Tuple` must implement `TheTrait<(&'0 isize, &'1 isize)>`, for any two lifetimes `'0` and `'1`... - = note: ...but it actually implements `TheTrait<(&'2 isize, &'2 isize)>`, for some specific lifetime `'2` +note: ...but it actually implements `TheTrait<(&'2 isize, &'2 isize)>`, for some specific lifetime `'2` + --> $DIR/associated-types-eq-hr.rs:35:1 + | +LL | impl<'a> TheTrait<(&'a isize, &'a isize)> for Tuple { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: aborting due to 12 previous errors diff --git a/tests/ui/closures/deduce-signature/obligation-with-leaking-placeholders.current.stderr b/tests/ui/closures/deduce-signature/obligation-with-leaking-placeholders.current.stderr index 3de229af2a077..f7f000992c06c 100644 --- a/tests/ui/closures/deduce-signature/obligation-with-leaking-placeholders.current.stderr +++ b/tests/ui/closures/deduce-signature/obligation-with-leaking-placeholders.current.stderr @@ -15,7 +15,11 @@ LL | | }); | |______^ | = note: ...`Wrap<{closure@...}>` must implement `Foo<'0>`, for any lifetime `'0`... - = note: ...but it actually implements `Foo<'1>`, for some specific lifetime `'1` +note: ...but it actually implements `Foo<'1>`, for some specific lifetime `'1` + --> $DIR/obligation-with-leaking-placeholders.rs:15:1 + | +LL | impl<'a, T> Foo<'a> for Wrap where T: Fn(&'a i32) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 1 previous error diff --git a/tests/ui/higher-ranked/trait-bounds/hrtb-conflate-regions.stderr b/tests/ui/higher-ranked/trait-bounds/hrtb-conflate-regions.stderr index 830ed0638a80d..4111d1f82a89c 100644 --- a/tests/ui/higher-ranked/trait-bounds/hrtb-conflate-regions.stderr +++ b/tests/ui/higher-ranked/trait-bounds/hrtb-conflate-regions.stderr @@ -10,7 +10,11 @@ LL | fn b() { want_foo2::(); } | ^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: ...`SomeStruct` must implement `Foo<(&'0 isize, &'1 isize)>`, for any two lifetimes `'0` and `'1`... - = note: ...but it actually implements `Foo<(&'2 isize, &'2 isize)>`, for some specific lifetime `'2` +note: ...but it actually implements `Foo<(&'2 isize, &'2 isize)>`, for some specific lifetime `'2` + --> $DIR/hrtb-conflate-regions.rs:22:1 + | +LL | impl<'a> Foo<(&'a isize, &'a isize)> for SomeStruct + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: implementation of `Foo` is not general enough --> $DIR/hrtb-conflate-regions.rs:27:10 @@ -24,7 +28,11 @@ LL | fn b() { want_foo2::(); } | ^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: ...`SomeStruct` must implement `Foo<(&'0 isize, &'1 isize)>`, for any two lifetimes `'0` and `'1`... - = note: ...but it actually implements `Foo<(&'2 isize, &'2 isize)>`, for some specific lifetime `'2` +note: ...but it actually implements `Foo<(&'2 isize, &'2 isize)>`, for some specific lifetime `'2` + --> $DIR/hrtb-conflate-regions.rs:22:1 + | +LL | impl<'a> Foo<(&'a isize, &'a isize)> for SomeStruct + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: aborting due to 2 previous errors diff --git a/tests/ui/higher-ranked/trait-bounds/hrtb-exists-forall-trait-contravariant.stderr b/tests/ui/higher-ranked/trait-bounds/hrtb-exists-forall-trait-contravariant.stderr index 28ae64dff3e47..d27bf6588cddf 100644 --- a/tests/ui/higher-ranked/trait-bounds/hrtb-exists-forall-trait-contravariant.stderr +++ b/tests/ui/higher-ranked/trait-bounds/hrtb-exists-forall-trait-contravariant.stderr @@ -11,7 +11,11 @@ LL | foo::<()>(); | ^^^^^^^^^^^ | = note: ...`()` must implement `Trait fn(&'b u32)>` - = note: ...but it actually implements `Trait`, for some specific lifetime `'0` +note: ...but it actually implements `Trait`, for some specific lifetime `'0` + --> $DIR/hrtb-exists-forall-trait-contravariant.rs:14:1 + | +LL | impl<'a> Trait for () {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 1 previous error diff --git a/tests/ui/higher-ranked/trait-bounds/hrtb-exists-forall-trait-covariant.stderr b/tests/ui/higher-ranked/trait-bounds/hrtb-exists-forall-trait-covariant.stderr index 4b9d7e1d7109e..0fd20dbb3f0e5 100644 --- a/tests/ui/higher-ranked/trait-bounds/hrtb-exists-forall-trait-covariant.stderr +++ b/tests/ui/higher-ranked/trait-bounds/hrtb-exists-forall-trait-covariant.stderr @@ -11,7 +11,11 @@ LL | foo::<()>(); | ^^^^^^^^^^^ | = note: ...`()` must implement `Trait fn(fn(&'b u32))>` - = note: ...but it actually implements `Trait`, for some specific lifetime `'0` +note: ...but it actually implements `Trait`, for some specific lifetime `'0` + --> $DIR/hrtb-exists-forall-trait-covariant.rs:14:1 + | +LL | impl<'a> Trait for () {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 1 previous error diff --git a/tests/ui/higher-ranked/trait-bounds/hrtb-exists-forall-trait-invariant.stderr b/tests/ui/higher-ranked/trait-bounds/hrtb-exists-forall-trait-invariant.stderr index 45ff3ef758713..eaecabbf544e1 100644 --- a/tests/ui/higher-ranked/trait-bounds/hrtb-exists-forall-trait-invariant.stderr +++ b/tests/ui/higher-ranked/trait-bounds/hrtb-exists-forall-trait-invariant.stderr @@ -11,7 +11,11 @@ LL | foo::<()>(); | ^^^^^^^^^^^ | = note: ...`()` must implement `Trait fn(Cell<&'b u32>)>` - = note: ...but it actually implements `Trait)>`, for some specific lifetime `'0` +note: ...but it actually implements `Trait)>`, for some specific lifetime `'0` + --> $DIR/hrtb-exists-forall-trait-invariant.rs:16:1 + | +LL | impl<'a> Trait)> for () {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 1 previous error diff --git a/tests/ui/higher-ranked/trait-bounds/hrtb-just-for-static.stderr b/tests/ui/higher-ranked/trait-bounds/hrtb-just-for-static.stderr index 6ba3d119ccb94..1f33e65e7e715 100644 --- a/tests/ui/higher-ranked/trait-bounds/hrtb-just-for-static.stderr +++ b/tests/ui/higher-ranked/trait-bounds/hrtb-just-for-static.stderr @@ -10,7 +10,11 @@ LL | want_hrtb::() | ^^^^^^^^^^^^^^^^^^^^^^^^ | = note: ...`StaticInt` must implement `Foo<&'0 isize>`, for any lifetime `'0`... - = note: ...but it actually implements `Foo<&'static isize>` +note: ...but it actually implements `Foo<&'static isize>` + --> $DIR/hrtb-just-for-static.rs:22:1 + | +LL | impl Foo<&'static isize> for StaticInt { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: lifetime may not live long enough --> $DIR/hrtb-just-for-static.rs:30:5 diff --git a/tests/ui/higher-ranked/trait-bounds/hrtb-perfect-forwarding.stderr b/tests/ui/higher-ranked/trait-bounds/hrtb-perfect-forwarding.stderr index db22eeb46aef0..2b68dced8af0d 100644 --- a/tests/ui/higher-ranked/trait-bounds/hrtb-perfect-forwarding.stderr +++ b/tests/ui/higher-ranked/trait-bounds/hrtb-perfect-forwarding.stderr @@ -66,7 +66,11 @@ LL | foo_hrtb_bar_not(&mut t); | ^^^^^^^^^^^^^^^^^^^^^^^^ | = note: ...`T` must implement `Bar<&'0 isize>`, for any lifetime `'0`... - = note: ...but it actually implements `Bar<&'1 isize>`, for some specific lifetime `'1` +note: ...but it actually implements `Bar<&'1 isize>`, for some specific lifetime `'1` + --> $DIR/hrtb-perfect-forwarding.rs:14:1 + | +LL | impl<'a, X, F> Bar for &'a mut F where F: Bar {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: function cannot return without recursing --> $DIR/hrtb-perfect-forwarding.rs:48:1 diff --git a/tests/ui/impl-trait/nested-rpit-hrtb.stderr b/tests/ui/impl-trait/nested-rpit-hrtb.stderr index 6c1253678e991..1f21373210a6d 100644 --- a/tests/ui/impl-trait/nested-rpit-hrtb.stderr +++ b/tests/ui/impl-trait/nested-rpit-hrtb.stderr @@ -102,7 +102,11 @@ LL | fn one_hrtb_mention_fn_outlives_uses<'b>() -> impl for<'a> Bar<'a, Assoc = | ^^ implementation of `Bar` is not general enough | = note: `()` must implement `Bar<'a>` - = note: ...but it actually implements `Bar<'0>`, for some specific lifetime `'0` +note: ...but it actually implements `Bar<'0>`, for some specific lifetime `'0` + --> $DIR/nested-rpit-hrtb.rs:16:1 + | +LL | impl<'a> Bar<'a> for () { + | ^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `for<'a, 'b> &'a (): Qux<'b>` is not satisfied --> $DIR/nested-rpit-hrtb.rs:60:64 From 3862c503043e2f26648b8fd634ba8854958aa266 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Wed, 30 Sep 2026 23:04:22 +0000 Subject: [PATCH 2/5] Tweak "not general enough" rendering Use a span note instead of span labels so that when talking about the trait that should have been implemented, we always point at where the obligation was introduced in a consistent place. ``` error: implementation of `TheTrait` is not general enough --> $DIR/associated-types-eq-hr.rs:96:5 | LL | tuple_one::(); | ^^^^^^^^^^^^^^^^^^^^ | note: `Tuple` must implement `TheTrait<(&'0 isize, &'1 isize)>`, for any two lifetimes `'0` and `'1`... --> $DIR/associated-types-eq-hr.rs:59:8 | LL | fn tuple_one() | --------- due to a where-clause on `tuple_one` LL | where LL | T: for<'x, 'y> TheTrait<(&'x isize, &'y isize), A = &'x isize>, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unsatisfied where-clause on `tuple_one` note: ...but it actually implements `TheTrait<(&'2 isize, &'2 isize)>`, for some specific lifetime `'2` --> $DIR/associated-types-eq-hr.rs:35:1 | LL | impl<'a> TheTrait<(&'a isize, &'a isize)> for Tuple { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ``` --- .../rustc_trait_selection/src/diagnostics.rs | 198 +++++++++--------- .../nice_region_error/placeholder_error.rs | 28 ++- .../associated-types-eq-hr.stderr | 120 ++++++----- ...outine-auto-trait-span-issue-155880.stderr | 13 +- ...olved-typeck-results.no_assumptions.stderr | 26 +-- ...ranked-auto-trait-12.no_assumptions.stderr | 13 +- ...er-ranked-auto-trait-13.assumptions.stderr | 52 ++--- ...ranked-auto-trait-13.no_assumptions.stderr | 78 +++---- ...ranked-auto-trait-15.no_assumptions.stderr | 26 +-- ...er-ranked-auto-trait-16.assumptions.stderr | 26 +-- ...ranked-auto-trait-16.no_assumptions.stderr | 26 +-- ...-ranked-auto-trait-5.no_assumptions.stderr | 15 +- .../issue-110963-early.no_assumptions.stderr | 30 +-- ...ation-not-general-enough-ice-133252.stderr | 11 +- ...n-with-leaking-placeholders.current.stderr | 15 +- ...rtb-closure-suggest-type-annotation.stderr | 30 +-- tests/ui/coroutine/auto-trait-regions.stderr | 26 +-- .../ui/coroutine/resume-arg-late-bound.stderr | 13 +- ...ot-checked-with-right-substitutions.stderr | 13 +- ...hr-fn-ptr-trait-impl-mismatch-29061.stderr | 39 ++-- ...tb-associated-type-leak-check-55731.stderr | 15 +- ...n-ptr-impl-not-general-enough-57936.stderr | 13 +- .../trait-bounds/hrtb-conflate-regions.stderr | 26 +-- ...b-exists-forall-trait-contravariant.stderr | 15 +- .../hrtb-exists-forall-trait-covariant.stderr | 15 +- .../hrtb-exists-forall-trait-invariant.stderr | 15 +- .../trait-bounds/hrtb-just-for-static.stderr | 13 +- .../hrtb-perfect-forwarding.stderr | 15 +- .../trait-bounds/issue-46989.stderr | 13 +- .../trait-bounds/issue-59311.stderr | 30 +-- .../issue-71955.current.stderr | 60 +++--- tests/ui/lifetimes/issue-105675.stderr | 78 +++---- tests/ui/lifetimes/issue-79187-2.stderr | 26 +-- tests/ui/lifetimes/issue-79187.stderr | 26 +-- .../lifetime-errors/issue_74400.stderr | 22 +- .../closure-arg-type-mismatch.stderr | 26 +-- .../closure-mismatch.current.stderr | 52 ++--- tests/ui/nll/ice-106874.stderr | 54 ++--- tests/ui/nll/issue-54302-cases.stderr | 44 ++-- ...missing-universe-cause-issue-114907.stderr | 52 ++--- ...insensitive-scopes-issue-117146.nll.stderr | 22 +- ...sitive-scopes-issue-117146.polonius.stderr | 22 +- .../impl-fn-ignore-binder-via-bottom.stderr | 22 +- tests/ui/unboxed-closures/issue-30906.stderr | 13 +- .../ui/where-clauses/where-for-self-2.stderr | 15 +- 45 files changed, 797 insertions(+), 705 deletions(-) diff --git a/compiler/rustc_trait_selection/src/diagnostics.rs b/compiler/rustc_trait_selection/src/diagnostics.rs index 917f2e83c2282..9d2238c188157 100644 --- a/compiler/rustc_trait_selection/src/diagnostics.rs +++ b/compiler/rustc_trait_selection/src/diagnostics.rs @@ -912,133 +912,123 @@ impl IntoDiagArg for TyOrSig<'_> { #[derive(Subdiagnostic)] pub(crate) enum ActualImplExplNotes<'tcx> { - #[note("{$leading_ellipsis -> - [true] ... - *[false] {\"\"} - }closure with signature `{$ty_or_sig}` must implement `{$trait_path}`, for any two lifetimes `'{$lifetime_1}` and `'{$lifetime_2}`...")] + #[note( + "closure with signature `{$ty_or_sig}` must implement `{$trait_path}`, for any two \ + lifetimes `'{$lifetime_1}` and `'{$lifetime_2}`..." + )] ExpectedSignatureTwo { - leading_ellipsis: bool, + #[primary_span] + span: MultiSpan, ty_or_sig: TyOrSig<'tcx>, trait_path: Highlighted<'tcx, TraitRefPrintOnlyTraitPath<'tcx>>, lifetime_1: usize, lifetime_2: usize, }, - #[note("{$leading_ellipsis -> - [true] ... - *[false] {\"\"} - }closure with signature `{$ty_or_sig}` must implement `{$trait_path}`, for any lifetime `'{$lifetime_1}`...")] + #[note( + "closure with signature `{$ty_or_sig}` must implement `{$trait_path}`, for any lifetime \ + `'{$lifetime_1}`..." + )] ExpectedSignatureAny { - leading_ellipsis: bool, + #[primary_span] + span: MultiSpan, ty_or_sig: TyOrSig<'tcx>, trait_path: Highlighted<'tcx, TraitRefPrintOnlyTraitPath<'tcx>>, lifetime_1: usize, }, - #[note("{$leading_ellipsis -> - [true] ... - *[false] {\"\"} - }closure with signature `{$ty_or_sig}` must implement `{$trait_path}`, for some specific lifetime `'{$lifetime_1}`...")] + #[note( + "closure with signature `{$ty_or_sig}` must implement `{$trait_path}`, for some specific \ + lifetime `'{$lifetime_1}`..." + )] ExpectedSignatureSome { - leading_ellipsis: bool, + #[primary_span] + span: MultiSpan, ty_or_sig: TyOrSig<'tcx>, trait_path: Highlighted<'tcx, TraitRefPrintOnlyTraitPath<'tcx>>, lifetime_1: usize, }, - #[note( - "{$leading_ellipsis -> - [true] ... - *[false] {\"\"} - }closure with signature `{$ty_or_sig}` must implement `{$trait_path}`" - )] + #[note("closure with signature `{$ty_or_sig}` must implement `{$trait_path}`")] ExpectedSignatureNothing { - leading_ellipsis: bool, + #[primary_span] + span: MultiSpan, ty_or_sig: TyOrSig<'tcx>, trait_path: Highlighted<'tcx, TraitRefPrintOnlyTraitPath<'tcx>>, }, - #[note("{$leading_ellipsis -> - [true] ... - *[false] {\"\"} - }`{$trait_path}` would have to be implemented for the type `{$ty_or_sig}`, for any two lifetimes `'{$lifetime_1}` and `'{$lifetime_2}`...")] + #[note( + "`{$trait_path}` would have to be implemented for the type `{$ty_or_sig}`, for any two \ + lifetimes `'{$lifetime_1}` and `'{$lifetime_2}`..." + )] ExpectedPassiveTwo { - leading_ellipsis: bool, + #[primary_span] + span: MultiSpan, ty_or_sig: TyOrSig<'tcx>, trait_path: Highlighted<'tcx, TraitRefPrintOnlyTraitPath<'tcx>>, lifetime_1: usize, lifetime_2: usize, }, - #[note("{$leading_ellipsis -> - [true] ... - *[false] {\"\"} - }`{$trait_path}` would have to be implemented for the type `{$ty_or_sig}`, for any lifetime `'{$lifetime_1}`...")] + #[note( + "`{$trait_path}` would have to be implemented for the type `{$ty_or_sig}`, for any \ + lifetime `'{$lifetime_1}`..." + )] ExpectedPassiveAny { - leading_ellipsis: bool, + #[primary_span] + span: MultiSpan, ty_or_sig: TyOrSig<'tcx>, trait_path: Highlighted<'tcx, TraitRefPrintOnlyTraitPath<'tcx>>, lifetime_1: usize, }, - #[note("{$leading_ellipsis -> - [true] ... - *[false] {\"\"} - }`{$trait_path}` would have to be implemented for the type `{$ty_or_sig}`, for some specific lifetime `'{$lifetime_1}`...")] + #[note( + "`{$trait_path}` would have to be implemented for the type `{$ty_or_sig}`, for some \ + specific lifetime `'{$lifetime_1}`..." + )] ExpectedPassiveSome { - leading_ellipsis: bool, + #[primary_span] + span: MultiSpan, ty_or_sig: TyOrSig<'tcx>, trait_path: Highlighted<'tcx, TraitRefPrintOnlyTraitPath<'tcx>>, lifetime_1: usize, }, - #[note( - "{$leading_ellipsis -> - [true] ... - *[false] {\"\"} - }`{$trait_path}` would have to be implemented for the type `{$ty_or_sig}`" - )] + #[note("`{$trait_path}` would have to be implemented for the type `{$ty_or_sig}`")] ExpectedPassiveNothing { - leading_ellipsis: bool, + #[primary_span] + span: MultiSpan, ty_or_sig: TyOrSig<'tcx>, trait_path: Highlighted<'tcx, TraitRefPrintOnlyTraitPath<'tcx>>, }, - #[note("{$leading_ellipsis -> - [true] ... - *[false] {\"\"} - }`{$ty_or_sig}` must implement `{$trait_path}`, for any two lifetimes `'{$lifetime_1}` and `'{$lifetime_2}`...")] + #[note( + "`{$ty_or_sig}` must implement `{$trait_path}`, for any two lifetimes `'{$lifetime_1}` and \ + `'{$lifetime_2}`..." + )] ExpectedOtherTwo { - leading_ellipsis: bool, + #[primary_span] + span: MultiSpan, ty_or_sig: TyOrSig<'tcx>, trait_path: Highlighted<'tcx, TraitRefPrintOnlyTraitPath<'tcx>>, lifetime_1: usize, lifetime_2: usize, }, - #[note( - "{$leading_ellipsis -> - [true] ... - *[false] {\"\"} - }`{$ty_or_sig}` must implement `{$trait_path}`, for any lifetime `'{$lifetime_1}`..." - )] + #[note("`{$ty_or_sig}` must implement `{$trait_path}`, for any lifetime `'{$lifetime_1}`...")] ExpectedOtherAny { - leading_ellipsis: bool, + #[primary_span] + span: MultiSpan, ty_or_sig: TyOrSig<'tcx>, trait_path: Highlighted<'tcx, TraitRefPrintOnlyTraitPath<'tcx>>, lifetime_1: usize, }, #[note( - "{$leading_ellipsis -> - [true] ... - *[false] {\"\"} - }`{$ty_or_sig}` must implement `{$trait_path}`, for some specific lifetime `'{$lifetime_1}`..." + "`{$ty_or_sig}` must implement `{$trait_path}`, for some specific lifetime \ + `'{$lifetime_1}`..." )] ExpectedOtherSome { - leading_ellipsis: bool, + #[primary_span] + span: MultiSpan, ty_or_sig: TyOrSig<'tcx>, trait_path: Highlighted<'tcx, TraitRefPrintOnlyTraitPath<'tcx>>, lifetime_1: usize, }, - #[note( - "{$leading_ellipsis -> - [true] ... - *[false] {\"\"} - }`{$ty_or_sig}` must implement `{$trait_path}`" - )] + #[note("`{$ty_or_sig}` must implement `{$trait_path}`")] ExpectedOtherNothing { - leading_ellipsis: bool, + #[primary_span] + span: MultiSpan, ty_or_sig: TyOrSig<'tcx>, trait_path: Highlighted<'tcx, TraitRefPrintOnlyTraitPath<'tcx>>, }, @@ -1098,66 +1088,71 @@ impl<'tcx> ActualImplExplNotes<'tcx> { pub(crate) fn new_expected( kind: ActualImplExpectedKind, lt_kind: ActualImplExpectedLifetimeKind, - leading_ellipsis: bool, ty_or_sig: TyOrSig<'tcx>, trait_path: Highlighted<'tcx, TraitRefPrintOnlyTraitPath<'tcx>>, lifetime_1: usize, lifetime_2: usize, + satisfy_span: Option, + item_span: Option, + item_name: String, ) -> Self { + let label = format!("unsatisfied where-clause on `{item_name}`"); + let item_label = format!("due to a where-clause on `{item_name}`"); + let span = match (satisfy_span, item_span) { + (Some(satisfy_span), Some(item_span)) => { + let mut span = MultiSpan::from(satisfy_span); + span.push_span_label(satisfy_span, label); + span.push_span_label(item_span, item_label); + span + } + (None, Some(item_span)) => { + let mut span = MultiSpan::from(item_span); + span.push_span_label(item_span, item_label); + span + } + (Some(satisfy_span), None) => { + let mut span = MultiSpan::from(satisfy_span); + span.push_span_label(satisfy_span, label); + span + } + _ => MultiSpan::from(vec![]), + }; match (kind, lt_kind) { (ActualImplExpectedKind::Signature, ActualImplExpectedLifetimeKind::Two) => { - Self::ExpectedSignatureTwo { - leading_ellipsis, - ty_or_sig, - trait_path, - lifetime_1, - lifetime_2, - } + Self::ExpectedSignatureTwo { span, ty_or_sig, trait_path, lifetime_1, lifetime_2 } } (ActualImplExpectedKind::Signature, ActualImplExpectedLifetimeKind::Any) => { - Self::ExpectedSignatureAny { leading_ellipsis, ty_or_sig, trait_path, lifetime_1 } + Self::ExpectedSignatureAny { span, ty_or_sig, trait_path, lifetime_1 } } (ActualImplExpectedKind::Signature, ActualImplExpectedLifetimeKind::Some) => { - Self::ExpectedSignatureSome { leading_ellipsis, ty_or_sig, trait_path, lifetime_1 } + Self::ExpectedSignatureSome { span, ty_or_sig, trait_path, lifetime_1 } } (ActualImplExpectedKind::Signature, ActualImplExpectedLifetimeKind::Nothing) => { - Self::ExpectedSignatureNothing { leading_ellipsis, ty_or_sig, trait_path } + Self::ExpectedSignatureNothing { span, ty_or_sig, trait_path } } (ActualImplExpectedKind::Passive, ActualImplExpectedLifetimeKind::Two) => { - Self::ExpectedPassiveTwo { - leading_ellipsis, - ty_or_sig, - trait_path, - lifetime_1, - lifetime_2, - } + Self::ExpectedPassiveTwo { span, ty_or_sig, trait_path, lifetime_1, lifetime_2 } } (ActualImplExpectedKind::Passive, ActualImplExpectedLifetimeKind::Any) => { - Self::ExpectedPassiveAny { leading_ellipsis, ty_or_sig, trait_path, lifetime_1 } + Self::ExpectedPassiveAny { span, ty_or_sig, trait_path, lifetime_1 } } (ActualImplExpectedKind::Passive, ActualImplExpectedLifetimeKind::Some) => { - Self::ExpectedPassiveSome { leading_ellipsis, ty_or_sig, trait_path, lifetime_1 } + Self::ExpectedPassiveSome { span, ty_or_sig, trait_path, lifetime_1 } } (ActualImplExpectedKind::Passive, ActualImplExpectedLifetimeKind::Nothing) => { - Self::ExpectedPassiveNothing { leading_ellipsis, ty_or_sig, trait_path } + Self::ExpectedPassiveNothing { span, ty_or_sig, trait_path } } (ActualImplExpectedKind::Other, ActualImplExpectedLifetimeKind::Two) => { - Self::ExpectedOtherTwo { - leading_ellipsis, - ty_or_sig, - trait_path, - lifetime_1, - lifetime_2, - } + Self::ExpectedOtherTwo { span, ty_or_sig, trait_path, lifetime_1, lifetime_2 } } (ActualImplExpectedKind::Other, ActualImplExpectedLifetimeKind::Any) => { - Self::ExpectedOtherAny { leading_ellipsis, ty_or_sig, trait_path, lifetime_1 } + Self::ExpectedOtherAny { span, ty_or_sig, trait_path, lifetime_1 } } (ActualImplExpectedKind::Other, ActualImplExpectedLifetimeKind::Some) => { - Self::ExpectedOtherSome { leading_ellipsis, ty_or_sig, trait_path, lifetime_1 } + Self::ExpectedOtherSome { span, ty_or_sig, trait_path, lifetime_1 } } (ActualImplExpectedKind::Other, ActualImplExpectedLifetimeKind::Nothing) => { - Self::ExpectedOtherNothing { leading_ellipsis, ty_or_sig, trait_path } + Self::ExpectedOtherNothing { span, ty_or_sig, trait_path } } } } @@ -1168,13 +1163,8 @@ impl<'tcx> ActualImplExplNotes<'tcx> { pub(crate) struct TraitPlaceholderMismatch<'tcx> { #[primary_span] pub span: Span, - #[label("unsatisfied where-clause on `{$def_id}`")] - pub satisfy_span: Option, - #[label("due to a where-clause on `{$def_id}`...")] - pub where_span: Option, #[label("implementation of `{$trait_def_id}` is not general enough")] pub dup_span: Option, - pub def_id: String, pub trait_def_id: String, #[subdiagnostic] diff --git a/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/placeholder_error.rs b/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/placeholder_error.rs index 07b4a142e4014..1b57e3d77d503 100644 --- a/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/placeholder_error.rs +++ b/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/placeholder_error.rs @@ -8,7 +8,7 @@ use rustc_hir::def_id::{CRATE_DEF_ID, DefId}; use rustc_middle::ty::error::ExpectedFound; use rustc_middle::ty::print::{FmtPrinter, Print, PrintTraitRefExt as _, RegionHighlightMode}; use rustc_middle::ty::{self, GenericArgsRef, IsSuggestable, RePlaceholder, Region, TyCtxt}; -use rustc_span::bug; +use rustc_span::{Span, bug}; use rustc_structures::Limit; use tracing::{debug, instrument}; @@ -279,13 +279,12 @@ impl<'tcx> NiceRegionError<'_, 'tcx> { _ => break, } } - let (leading_ellipsis, satisfy_span, where_span, dup_span, def_id) = + let (mut satisfy_span, mut item_span, dup_span, item_name) = if let ObligationCauseCode::WhereClause(def_id, span) | ObligationCauseCode::WhereClauseInExpr(def_id, span, ..) = *code && def_id != CRATE_DEF_ID.to_def_id() { ( - true, Some(span), Some( self.tcx() @@ -296,8 +295,14 @@ impl<'tcx> NiceRegionError<'_, 'tcx> { self.tcx().def_path_str(def_id), ) } else { - (false, None, None, Some(span), String::new()) + (None, None, Some(span), String::new()) }; + if let Some(span) = satisfy_span && span.is_dummy() { + satisfy_span = None; + } + if let Some(span) = item_span && span.is_dummy() { + item_span = None; + } let expected_trait_ref = self.cx.deeply_resolve_ignoring_regions( ty::TraitRef::new_from_args(self.cx.tcx, trait_def_id, expected_args), @@ -369,15 +374,14 @@ impl<'tcx> NiceRegionError<'_, 'tcx> { expected_has_vid, actual_has_vid, any_self_ty_has_vid, - leading_ellipsis, + satisfy_span, + item_span, + item_name, ); let mut err = self.tcx().dcx().create_err(TraitPlaceholderMismatch { span, - satisfy_span, - where_span, dup_span, - def_id, trait_def_id: self.tcx().def_path_str(trait_def_id), actual_impl_expl_notes, }); @@ -494,7 +498,9 @@ impl<'tcx> NiceRegionError<'_, 'tcx> { expected_has_vid: Option, actual_has_vid: Option, any_self_ty_has_vid: bool, - leading_ellipsis: bool, + satisfy_span: Option, + item_span: Option, + item_name: String, ) -> Vec> { // The weird thing here with the `maybe_highlighting_region` calls and the // the match inside is meant to be like this: @@ -592,11 +598,13 @@ impl<'tcx> NiceRegionError<'_, 'tcx> { let note_1 = ActualImplExplNotes::new_expected( kind, lt_kind, - leading_ellipsis, ty_or_sig, trait_path, lifetime_1, lifetime_2, + satisfy_span, + item_span, + item_name, ); let mut actual_trait_ref = highlight_trait_ref(actual_trait_ref); diff --git a/tests/ui/associated-types/associated-types-eq-hr.stderr b/tests/ui/associated-types/associated-types-eq-hr.stderr index 4a24b75700b8b..19fd633334f00 100644 --- a/tests/ui/associated-types/associated-types-eq-hr.stderr +++ b/tests/ui/associated-types/associated-types-eq-hr.stderr @@ -43,16 +43,17 @@ LL | T: for<'x> TheTrait<&'x isize, A = &'x usize>, error: implementation of `TheTrait` is not general enough --> $DIR/associated-types-eq-hr.rs:96:5 | -LL | fn tuple_one() - | --------- due to a where-clause on `tuple_one`... -LL | where -LL | T: for<'x, 'y> TheTrait<(&'x isize, &'y isize), A = &'x isize>, - | ----------------------------------------------------------- unsatisfied where-clause on `tuple_one` -... LL | tuple_one::(); | ^^^^^^^^^^^^^^^^^^^^ | - = note: ...`Tuple` must implement `TheTrait<(&'0 isize, &'1 isize)>`, for any two lifetimes `'0` and `'1`... +note: `Tuple` must implement `TheTrait<(&'0 isize, &'1 isize)>`, for any two lifetimes `'0` and `'1`... + --> $DIR/associated-types-eq-hr.rs:59:8 + | +LL | fn tuple_one() + | --------- due to a where-clause on `tuple_one` +LL | where +LL | T: for<'x, 'y> TheTrait<(&'x isize, &'y isize), A = &'x isize>, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unsatisfied where-clause on `tuple_one` note: ...but it actually implements `TheTrait<(&'2 isize, &'2 isize)>`, for some specific lifetime `'2` --> $DIR/associated-types-eq-hr.rs:35:1 | @@ -62,16 +63,17 @@ LL | impl<'a> TheTrait<(&'a isize, &'a isize)> for Tuple { error: implementation of `TheTrait` is not general enough --> $DIR/associated-types-eq-hr.rs:96:5 | -LL | fn tuple_one() - | --------- due to a where-clause on `tuple_one`... -LL | where -LL | T: for<'x, 'y> TheTrait<(&'x isize, &'y isize), A = &'x isize>, - | ----------------------------------------------------------- unsatisfied where-clause on `tuple_one` -... LL | tuple_one::(); | ^^^^^^^^^^^^^^^^^^^^ | - = note: ...`Tuple` must implement `TheTrait<(&'0 isize, &'1 isize)>`, for any two lifetimes `'0` and `'1`... +note: `Tuple` must implement `TheTrait<(&'0 isize, &'1 isize)>`, for any two lifetimes `'0` and `'1`... + --> $DIR/associated-types-eq-hr.rs:59:8 + | +LL | fn tuple_one() + | --------- due to a where-clause on `tuple_one` +LL | where +LL | T: for<'x, 'y> TheTrait<(&'x isize, &'y isize), A = &'x isize>, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unsatisfied where-clause on `tuple_one` note: ...but it actually implements `TheTrait<(&'2 isize, &'2 isize)>`, for some specific lifetime `'2` --> $DIR/associated-types-eq-hr.rs:35:1 | @@ -82,16 +84,17 @@ LL | impl<'a> TheTrait<(&'a isize, &'a isize)> for Tuple { error: implementation of `TheTrait` is not general enough --> $DIR/associated-types-eq-hr.rs:96:5 | -LL | fn tuple_one() - | --------- due to a where-clause on `tuple_one`... -LL | where -LL | T: for<'x, 'y> TheTrait<(&'x isize, &'y isize), A = &'x isize>, - | ------------- unsatisfied where-clause on `tuple_one` -... LL | tuple_one::(); | ^^^^^^^^^^^^^^^^^^^^ | - = note: ...`Tuple` must implement `TheTrait<(&'0 isize, &'1 isize)>`, for any two lifetimes `'0` and `'1`... +note: `Tuple` must implement `TheTrait<(&'0 isize, &'1 isize)>`, for any two lifetimes `'0` and `'1`... + --> $DIR/associated-types-eq-hr.rs:59:53 + | +LL | fn tuple_one() + | --------- due to a where-clause on `tuple_one` +LL | where +LL | T: for<'x, 'y> TheTrait<(&'x isize, &'y isize), A = &'x isize>, + | ^^^^^^^^^^^^^ unsatisfied where-clause on `tuple_one` note: ...but it actually implements `TheTrait<(&'2 isize, &'2 isize)>`, for some specific lifetime `'2` --> $DIR/associated-types-eq-hr.rs:35:1 | @@ -101,16 +104,17 @@ LL | impl<'a> TheTrait<(&'a isize, &'a isize)> for Tuple { error: implementation of `TheTrait` is not general enough --> $DIR/associated-types-eq-hr.rs:96:5 | -LL | fn tuple_one() - | --------- due to a where-clause on `tuple_one`... -LL | where -LL | T: for<'x, 'y> TheTrait<(&'x isize, &'y isize), A = &'x isize>, - | ------------- unsatisfied where-clause on `tuple_one` -... LL | tuple_one::(); | ^^^^^^^^^^^^^^^^^^^^ | - = note: ...`Tuple` must implement `TheTrait<(&'0 isize, &'1 isize)>`, for any two lifetimes `'0` and `'1`... +note: `Tuple` must implement `TheTrait<(&'0 isize, &'1 isize)>`, for any two lifetimes `'0` and `'1`... + --> $DIR/associated-types-eq-hr.rs:59:53 + | +LL | fn tuple_one() + | --------- due to a where-clause on `tuple_one` +LL | where +LL | T: for<'x, 'y> TheTrait<(&'x isize, &'y isize), A = &'x isize>, + | ^^^^^^^^^^^^^ unsatisfied where-clause on `tuple_one` note: ...but it actually implements `TheTrait<(&'2 isize, &'2 isize)>`, for some specific lifetime `'2` --> $DIR/associated-types-eq-hr.rs:35:1 | @@ -121,16 +125,17 @@ LL | impl<'a> TheTrait<(&'a isize, &'a isize)> for Tuple { error: implementation of `TheTrait` is not general enough --> $DIR/associated-types-eq-hr.rs:104:5 | -LL | fn tuple_two() - | --------- due to a where-clause on `tuple_two`... -LL | where -LL | T: for<'x, 'y> TheTrait<(&'x isize, &'y isize), A = &'y isize>, - | ----------------------------------------------------------- unsatisfied where-clause on `tuple_two` -... LL | tuple_two::(); | ^^^^^^^^^^^^^^^^^^^^ | - = note: ...`Tuple` must implement `TheTrait<(&'0 isize, &'1 isize)>`, for any two lifetimes `'0` and `'1`... +note: `Tuple` must implement `TheTrait<(&'0 isize, &'1 isize)>`, for any two lifetimes `'0` and `'1`... + --> $DIR/associated-types-eq-hr.rs:66:8 + | +LL | fn tuple_two() + | --------- due to a where-clause on `tuple_two` +LL | where +LL | T: for<'x, 'y> TheTrait<(&'x isize, &'y isize), A = &'y isize>, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unsatisfied where-clause on `tuple_two` note: ...but it actually implements `TheTrait<(&'2 isize, &'2 isize)>`, for some specific lifetime `'2` --> $DIR/associated-types-eq-hr.rs:35:1 | @@ -140,16 +145,17 @@ LL | impl<'a> TheTrait<(&'a isize, &'a isize)> for Tuple { error: implementation of `TheTrait` is not general enough --> $DIR/associated-types-eq-hr.rs:104:5 | -LL | fn tuple_two() - | --------- due to a where-clause on `tuple_two`... -LL | where -LL | T: for<'x, 'y> TheTrait<(&'x isize, &'y isize), A = &'y isize>, - | ----------------------------------------------------------- unsatisfied where-clause on `tuple_two` -... LL | tuple_two::(); | ^^^^^^^^^^^^^^^^^^^^ | - = note: ...`Tuple` must implement `TheTrait<(&'0 isize, &'1 isize)>`, for any two lifetimes `'0` and `'1`... +note: `Tuple` must implement `TheTrait<(&'0 isize, &'1 isize)>`, for any two lifetimes `'0` and `'1`... + --> $DIR/associated-types-eq-hr.rs:66:8 + | +LL | fn tuple_two() + | --------- due to a where-clause on `tuple_two` +LL | where +LL | T: for<'x, 'y> TheTrait<(&'x isize, &'y isize), A = &'y isize>, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unsatisfied where-clause on `tuple_two` note: ...but it actually implements `TheTrait<(&'2 isize, &'2 isize)>`, for some specific lifetime `'2` --> $DIR/associated-types-eq-hr.rs:35:1 | @@ -189,16 +195,17 @@ LL | T: for<'x, 'y> TheTrait<(&'x isize, &'y isize), A = &'y isize>, error: implementation of `TheTrait` is not general enough --> $DIR/associated-types-eq-hr.rs:116:5 | -LL | fn tuple_four() - | ---------- due to a where-clause on `tuple_four`... -LL | where -LL | T: for<'x, 'y> TheTrait<(&'x isize, &'y isize)>, - | -------------------------------------------- unsatisfied where-clause on `tuple_four` -... LL | tuple_four::(); | ^^^^^^^^^^^^^^^^^^^^^ | - = note: ...`Tuple` must implement `TheTrait<(&'0 isize, &'1 isize)>`, for any two lifetimes `'0` and `'1`... +note: `Tuple` must implement `TheTrait<(&'0 isize, &'1 isize)>`, for any two lifetimes `'0` and `'1`... + --> $DIR/associated-types-eq-hr.rs:80:8 + | +LL | fn tuple_four() + | ---------- due to a where-clause on `tuple_four` +LL | where +LL | T: for<'x, 'y> TheTrait<(&'x isize, &'y isize)>, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unsatisfied where-clause on `tuple_four` note: ...but it actually implements `TheTrait<(&'2 isize, &'2 isize)>`, for some specific lifetime `'2` --> $DIR/associated-types-eq-hr.rs:35:1 | @@ -208,16 +215,17 @@ LL | impl<'a> TheTrait<(&'a isize, &'a isize)> for Tuple { error: implementation of `TheTrait` is not general enough --> $DIR/associated-types-eq-hr.rs:116:5 | -LL | fn tuple_four() - | ---------- due to a where-clause on `tuple_four`... -LL | where -LL | T: for<'x, 'y> TheTrait<(&'x isize, &'y isize)>, - | -------------------------------------------- unsatisfied where-clause on `tuple_four` -... LL | tuple_four::(); | ^^^^^^^^^^^^^^^^^^^^^ | - = note: ...`Tuple` must implement `TheTrait<(&'0 isize, &'1 isize)>`, for any two lifetimes `'0` and `'1`... +note: `Tuple` must implement `TheTrait<(&'0 isize, &'1 isize)>`, for any two lifetimes `'0` and `'1`... + --> $DIR/associated-types-eq-hr.rs:80:8 + | +LL | fn tuple_four() + | ---------- due to a where-clause on `tuple_four` +LL | where +LL | T: for<'x, 'y> TheTrait<(&'x isize, &'y isize)>, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unsatisfied where-clause on `tuple_four` note: ...but it actually implements `TheTrait<(&'2 isize, &'2 isize)>`, for some specific lifetime `'2` --> $DIR/associated-types-eq-hr.rs:35:1 | diff --git a/tests/ui/async-await/coroutine-auto-trait-span-issue-155880.stderr b/tests/ui/async-await/coroutine-auto-trait-span-issue-155880.stderr index e7f5413cdaaa0..893124920ee18 100644 --- a/tests/ui/async-await/coroutine-auto-trait-span-issue-155880.stderr +++ b/tests/ui/async-await/coroutine-auto-trait-span-issue-155880.stderr @@ -7,15 +7,16 @@ LL | | std::future::ready(x).await LL | | } | |_- this async fn captures a value whose type is not `Send` ... -LL | fn is_send(_: T) {} - | ------- ---- unsatisfied where-clause on `is_send` - | | - | due to a where-clause on `is_send`... -... LL | is_send(outer()) | ^^^^^^^^^^^^^^^^ | - = note: ...`Send` would have to be implemented for the type `&'0 u32`, for any lifetime `'0`... +note: `Send` would have to be implemented for the type `&'0 u32`, for any lifetime `'0`... + --> $DIR/coroutine-auto-trait-span-issue-155880.rs:25:15 + | +LL | fn is_send(_: T) {} + | ------- ^^^^ unsatisfied where-clause on `is_send` + | | + | due to a where-clause on `is_send` = note: ...but `Send` is actually implemented for the type `&'1 u32`, for some specific lifetime `'1` error: aborting due to 1 previous error diff --git a/tests/ui/async-await/drop-tracking-unresolved-typeck-results.no_assumptions.stderr b/tests/ui/async-await/drop-tracking-unresolved-typeck-results.no_assumptions.stderr index 01b99e203c426..da93d5a17547a 100644 --- a/tests/ui/async-await/drop-tracking-unresolved-typeck-results.no_assumptions.stderr +++ b/tests/ui/async-await/drop-tracking-unresolved-typeck-results.no_assumptions.stderr @@ -1,33 +1,35 @@ error: implementation of `FnOnce` is not general enough --> $DIR/drop-tracking-unresolved-typeck-results.rs:102:5 | -LL | fn send(_: T) {} - | ---- ---- unsatisfied where-clause on `send` - | | - | due to a where-clause on `send`... -... LL | / send(async { LL | | Next(&Buffered(Map(Empty(PhantomData), ready::<&()>), FuturesOrdered(PhantomData), 0)).await LL | | }); | |______^ | - = note: ...`fn(&'0 ()) -> Ready<&'0 ()> {std::future::ready::<&'0 ()>}` must implement `FnOnce<(&'1 (),)>`, for any two lifetimes `'0` and `'1`... +note: `fn(&'0 ()) -> Ready<&'0 ()> {std::future::ready::<&'0 ()>}` must implement `FnOnce<(&'1 (),)>`, for any two lifetimes `'0` and `'1`... + --> $DIR/drop-tracking-unresolved-typeck-results.rs:13:12 + | +LL | fn send(_: T) {} + | ---- ^^^^ unsatisfied where-clause on `send` + | | + | due to a where-clause on `send` = note: ...but it actually implements `FnOnce<(&(),)>` error: implementation of `FnOnce` is not general enough --> $DIR/drop-tracking-unresolved-typeck-results.rs:102:5 | -LL | fn send(_: T) {} - | ---- ---- unsatisfied where-clause on `send` - | | - | due to a where-clause on `send`... -... LL | / send(async { LL | | Next(&Buffered(Map(Empty(PhantomData), ready::<&()>), FuturesOrdered(PhantomData), 0)).await LL | | }); | |______^ | - = note: ...`fn(&'0 ()) -> Ready<&'0 ()> {std::future::ready::<&'0 ()>}` must implement `FnOnce<(&'1 (),)>`, for any two lifetimes `'0` and `'1`... +note: `fn(&'0 ()) -> Ready<&'0 ()> {std::future::ready::<&'0 ()>}` must implement `FnOnce<(&'1 (),)>`, for any two lifetimes `'0` and `'1`... + --> $DIR/drop-tracking-unresolved-typeck-results.rs:13:12 + | +LL | fn send(_: T) {} + | ---- ^^^^ unsatisfied where-clause on `send` + | | + | due to a where-clause on `send` = note: ...but it actually implements `FnOnce<(&(),)>` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` diff --git a/tests/ui/async-await/higher-ranked-auto-trait-12.no_assumptions.stderr b/tests/ui/async-await/higher-ranked-auto-trait-12.no_assumptions.stderr index fd91fd659ac4d..39132cc9b4fb9 100644 --- a/tests/ui/async-await/higher-ranked-auto-trait-12.no_assumptions.stderr +++ b/tests/ui/async-await/higher-ranked-auto-trait-12.no_assumptions.stderr @@ -1,11 +1,6 @@ error: implementation of `Robot` is not general enough --> $DIR/higher-ranked-auto-trait-12.rs:31:20 | -LL | fn this_is_send(value: T) -> T { - | ------------ ---- unsatisfied where-clause on `this_is_send` - | | - | due to a where-clause on `this_is_send`... -... LL | let _my_task = this_is_send(async move { | ____________________^ LL | | let _my_iter = IRobot { @@ -16,7 +11,13 @@ LL | | yield_now().await; LL | | }); | |______^ | - = note: ...`Box<(dyn Robot + Send + '0)>` must implement `Robot`, for any lifetime `'0`... +note: `Box<(dyn Robot + Send + '0)>` must implement `Robot`, for any lifetime `'0`... + --> $DIR/higher-ranked-auto-trait-12.rs:24:20 + | +LL | fn this_is_send(value: T) -> T { + | ------------ ^^^^ unsatisfied where-clause on `this_is_send` + | | + | due to a where-clause on `this_is_send` = note: ...but `Robot` is actually implemented for the type `Box<(dyn Robot + Send + 'static)>` error: aborting due to 1 previous error diff --git a/tests/ui/async-await/higher-ranked-auto-trait-13.assumptions.stderr b/tests/ui/async-await/higher-ranked-auto-trait-13.assumptions.stderr index abc8ba5e7afa3..386a83ebbc761 100644 --- a/tests/ui/async-await/higher-ranked-auto-trait-13.assumptions.stderr +++ b/tests/ui/async-await/higher-ranked-auto-trait-13.assumptions.stderr @@ -1,58 +1,62 @@ error: implementation of `Getter` is not general enough --> $DIR/higher-ranked-auto-trait-13.rs:65:5 | -LL | fn assert_send(_: impl Send + Sync) {} - | ----------- ---- unsatisfied where-clause on `assert_send` - | | - | due to a where-clause on `assert_send`... -... LL | assert_send(my_send_async_method(struct_with_lifetime, data)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: ...`Getter<'1>` would have to be implemented for the type `GetterImpl<'0, ConstructableImpl<'_>>`, for any two lifetimes `'0` and `'1`... +note: `Getter<'1>` would have to be implemented for the type `GetterImpl<'0, ConstructableImpl<'_>>`, for any two lifetimes `'0` and `'1`... + --> $DIR/higher-ranked-auto-trait-13.rs:52:24 + | +LL | fn assert_send(_: impl Send + Sync) {} + | ----------- ^^^^ unsatisfied where-clause on `assert_send` + | | + | due to a where-clause on `assert_send` = note: ...but `Getter<'2>` is actually implemented for the type `GetterImpl<'2, ConstructableImpl<'_>>`, for some specific lifetime `'2` error: implementation of `Getter` is not general enough --> $DIR/higher-ranked-auto-trait-13.rs:65:5 | -LL | fn assert_send(_: impl Send + Sync) {} - | ----------- ---- unsatisfied where-clause on `assert_send` - | | - | due to a where-clause on `assert_send`... -... LL | assert_send(my_send_async_method(struct_with_lifetime, data)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: ...`Getter<'1>` would have to be implemented for the type `GetterImpl<'0, ConstructableImpl<'_>>`, for any two lifetimes `'0` and `'1`... +note: `Getter<'1>` would have to be implemented for the type `GetterImpl<'0, ConstructableImpl<'_>>`, for any two lifetimes `'0` and `'1`... + --> $DIR/higher-ranked-auto-trait-13.rs:52:24 + | +LL | fn assert_send(_: impl Send + Sync) {} + | ----------- ^^^^ unsatisfied where-clause on `assert_send` + | | + | due to a where-clause on `assert_send` = note: ...but `Getter<'2>` is actually implemented for the type `GetterImpl<'2, ConstructableImpl<'_>>`, for some specific lifetime `'2` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: implementation of `Getter` is not general enough --> $DIR/higher-ranked-auto-trait-13.rs:65:5 | -LL | fn assert_send(_: impl Send + Sync) {} - | ----------- ---- unsatisfied where-clause on `assert_send` - | | - | due to a where-clause on `assert_send`... -... LL | assert_send(my_send_async_method(struct_with_lifetime, data)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: ...`Getter<'1>` would have to be implemented for the type `GetterImpl<'0, ConstructableImpl<'_>>`, for any two lifetimes `'0` and `'1`... +note: `Getter<'1>` would have to be implemented for the type `GetterImpl<'0, ConstructableImpl<'_>>`, for any two lifetimes `'0` and `'1`... + --> $DIR/higher-ranked-auto-trait-13.rs:52:31 + | +LL | fn assert_send(_: impl Send + Sync) {} + | ----------- ^^^^ unsatisfied where-clause on `assert_send` + | | + | due to a where-clause on `assert_send` = note: ...but `Getter<'2>` is actually implemented for the type `GetterImpl<'2, ConstructableImpl<'_>>`, for some specific lifetime `'2` error: implementation of `Getter` is not general enough --> $DIR/higher-ranked-auto-trait-13.rs:65:5 | -LL | fn assert_send(_: impl Send + Sync) {} - | ----------- ---- unsatisfied where-clause on `assert_send` - | | - | due to a where-clause on `assert_send`... -... LL | assert_send(my_send_async_method(struct_with_lifetime, data)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: ...`Getter<'1>` would have to be implemented for the type `GetterImpl<'0, ConstructableImpl<'_>>`, for any two lifetimes `'0` and `'1`... +note: `Getter<'1>` would have to be implemented for the type `GetterImpl<'0, ConstructableImpl<'_>>`, for any two lifetimes `'0` and `'1`... + --> $DIR/higher-ranked-auto-trait-13.rs:52:31 + | +LL | fn assert_send(_: impl Send + Sync) {} + | ----------- ^^^^ unsatisfied where-clause on `assert_send` + | | + | due to a where-clause on `assert_send` = note: ...but `Getter<'2>` is actually implemented for the type `GetterImpl<'2, ConstructableImpl<'_>>`, for some specific lifetime `'2` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` diff --git a/tests/ui/async-await/higher-ranked-auto-trait-13.no_assumptions.stderr b/tests/ui/async-await/higher-ranked-auto-trait-13.no_assumptions.stderr index 7c8edb40ac62f..02f91c47fffcb 100644 --- a/tests/ui/async-await/higher-ranked-auto-trait-13.no_assumptions.stderr +++ b/tests/ui/async-await/higher-ranked-auto-trait-13.no_assumptions.stderr @@ -1,87 +1,93 @@ error: implementation of `Getter` is not general enough --> $DIR/higher-ranked-auto-trait-13.rs:65:5 | -LL | fn assert_send(_: impl Send + Sync) {} - | ----------- ---- unsatisfied where-clause on `assert_send` - | | - | due to a where-clause on `assert_send`... -... LL | assert_send(my_send_async_method(struct_with_lifetime, data)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: ...`Getter<'1>` would have to be implemented for the type `GetterImpl<'0, ConstructableImpl<'_>>`, for any two lifetimes `'0` and `'1`... +note: `Getter<'1>` would have to be implemented for the type `GetterImpl<'0, ConstructableImpl<'_>>`, for any two lifetimes `'0` and `'1`... + --> $DIR/higher-ranked-auto-trait-13.rs:52:24 + | +LL | fn assert_send(_: impl Send + Sync) {} + | ----------- ^^^^ unsatisfied where-clause on `assert_send` + | | + | due to a where-clause on `assert_send` = note: ...but `Getter<'2>` is actually implemented for the type `GetterImpl<'2, ConstructableImpl<'_>>`, for some specific lifetime `'2` error: implementation of `Getter` is not general enough --> $DIR/higher-ranked-auto-trait-13.rs:65:5 | -LL | fn assert_send(_: impl Send + Sync) {} - | ----------- ---- unsatisfied where-clause on `assert_send` - | | - | due to a where-clause on `assert_send`... -... LL | assert_send(my_send_async_method(struct_with_lifetime, data)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: ...`Getter<'1>` would have to be implemented for the type `GetterImpl<'0, ConstructableImpl<'_>>`, for any two lifetimes `'0` and `'1`... +note: `Getter<'1>` would have to be implemented for the type `GetterImpl<'0, ConstructableImpl<'_>>`, for any two lifetimes `'0` and `'1`... + --> $DIR/higher-ranked-auto-trait-13.rs:52:24 + | +LL | fn assert_send(_: impl Send + Sync) {} + | ----------- ^^^^ unsatisfied where-clause on `assert_send` + | | + | due to a where-clause on `assert_send` = note: ...but `Getter<'2>` is actually implemented for the type `GetterImpl<'2, ConstructableImpl<'_>>`, for some specific lifetime `'2` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: implementation of `Callable` is not general enough --> $DIR/higher-ranked-auto-trait-13.rs:65:5 | -LL | fn assert_send(_: impl Send + Sync) {} - | ----------- ---- unsatisfied where-clause on `assert_send` - | | - | due to a where-clause on `assert_send`... -... LL | assert_send(my_send_async_method(struct_with_lifetime, data)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: ...`Callable<'_>` would have to be implemented for the type `ConstructableImpl<'0>`, for any lifetime `'0`... +note: `Callable<'_>` would have to be implemented for the type `ConstructableImpl<'0>`, for any lifetime `'0`... + --> $DIR/higher-ranked-auto-trait-13.rs:52:24 + | +LL | fn assert_send(_: impl Send + Sync) {} + | ----------- ^^^^ unsatisfied where-clause on `assert_send` + | | + | due to a where-clause on `assert_send` = note: ...but `Callable<'1>` is actually implemented for the type `ConstructableImpl<'1>`, for some specific lifetime `'1` error: implementation of `Getter` is not general enough --> $DIR/higher-ranked-auto-trait-13.rs:65:5 | -LL | fn assert_send(_: impl Send + Sync) {} - | ----------- ---- unsatisfied where-clause on `assert_send` - | | - | due to a where-clause on `assert_send`... -... LL | assert_send(my_send_async_method(struct_with_lifetime, data)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: ...`Getter<'1>` would have to be implemented for the type `GetterImpl<'0, ConstructableImpl<'_>>`, for any two lifetimes `'0` and `'1`... +note: `Getter<'1>` would have to be implemented for the type `GetterImpl<'0, ConstructableImpl<'_>>`, for any two lifetimes `'0` and `'1`... + --> $DIR/higher-ranked-auto-trait-13.rs:52:31 + | +LL | fn assert_send(_: impl Send + Sync) {} + | ----------- ^^^^ unsatisfied where-clause on `assert_send` + | | + | due to a where-clause on `assert_send` = note: ...but `Getter<'2>` is actually implemented for the type `GetterImpl<'2, ConstructableImpl<'_>>`, for some specific lifetime `'2` error: implementation of `Getter` is not general enough --> $DIR/higher-ranked-auto-trait-13.rs:65:5 | -LL | fn assert_send(_: impl Send + Sync) {} - | ----------- ---- unsatisfied where-clause on `assert_send` - | | - | due to a where-clause on `assert_send`... -... LL | assert_send(my_send_async_method(struct_with_lifetime, data)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: ...`Getter<'1>` would have to be implemented for the type `GetterImpl<'0, ConstructableImpl<'_>>`, for any two lifetimes `'0` and `'1`... +note: `Getter<'1>` would have to be implemented for the type `GetterImpl<'0, ConstructableImpl<'_>>`, for any two lifetimes `'0` and `'1`... + --> $DIR/higher-ranked-auto-trait-13.rs:52:31 + | +LL | fn assert_send(_: impl Send + Sync) {} + | ----------- ^^^^ unsatisfied where-clause on `assert_send` + | | + | due to a where-clause on `assert_send` = note: ...but `Getter<'2>` is actually implemented for the type `GetterImpl<'2, ConstructableImpl<'_>>`, for some specific lifetime `'2` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: implementation of `Callable` is not general enough --> $DIR/higher-ranked-auto-trait-13.rs:65:5 | -LL | fn assert_send(_: impl Send + Sync) {} - | ----------- ---- unsatisfied where-clause on `assert_send` - | | - | due to a where-clause on `assert_send`... -... LL | assert_send(my_send_async_method(struct_with_lifetime, data)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: ...`Callable<'_>` would have to be implemented for the type `ConstructableImpl<'0>`, for any lifetime `'0`... +note: `Callable<'_>` would have to be implemented for the type `ConstructableImpl<'0>`, for any lifetime `'0`... + --> $DIR/higher-ranked-auto-trait-13.rs:52:31 + | +LL | fn assert_send(_: impl Send + Sync) {} + | ----------- ^^^^ unsatisfied where-clause on `assert_send` + | | + | due to a where-clause on `assert_send` = note: ...but `Callable<'1>` is actually implemented for the type `ConstructableImpl<'1>`, for some specific lifetime `'1` error: aborting due to 6 previous errors diff --git a/tests/ui/async-await/higher-ranked-auto-trait-15.no_assumptions.stderr b/tests/ui/async-await/higher-ranked-auto-trait-15.no_assumptions.stderr index fa6dd575527f8..c6c8479474c64 100644 --- a/tests/ui/async-await/higher-ranked-auto-trait-15.no_assumptions.stderr +++ b/tests/ui/async-await/higher-ranked-auto-trait-15.no_assumptions.stderr @@ -1,15 +1,16 @@ error: implementation of `FnOnce` is not general enough --> $DIR/higher-ranked-auto-trait-15.rs:20:5 | -LL | fn require_send(_x: T) {} - | ------------ ---- unsatisfied where-clause on `require_send` - | | - | due to a where-clause on `require_send`... -... LL | require_send(future); | ^^^^^^^^^^^^^^^^^^^^ | - = note: ...closure with signature `fn(&'0 _) -> Iter<'_, i32>` must implement `FnOnce<(&'1 Vec,)>`, for any two lifetimes `'0` and `'1`... +note: closure with signature `fn(&'0 _) -> Iter<'_, i32>` must implement `FnOnce<(&'1 Vec,)>`, for any two lifetimes `'0` and `'1`... + --> $DIR/higher-ranked-auto-trait-15.rs:16:20 + | +LL | fn require_send(_x: T) {} + | ------------ ^^^^ unsatisfied where-clause on `require_send` + | | + | due to a where-clause on `require_send` = note: ...but it actually implements `FnOnce<(&Vec,)>` help: consider adding an explicit type annotation to the closure's argument | @@ -19,15 +20,16 @@ LL | for _ in things.iter().map(|n: &Vec| n.iter()).flatten() { error: implementation of `FnOnce` is not general enough --> $DIR/higher-ranked-auto-trait-15.rs:20:5 | -LL | fn require_send(_x: T) {} - | ------------ ---- unsatisfied where-clause on `require_send` - | | - | due to a where-clause on `require_send`... -... LL | require_send(future); | ^^^^^^^^^^^^^^^^^^^^ | - = note: ...closure with signature `fn(&'0 _) -> Iter<'_, i32>` must implement `FnOnce<(&'1 Vec,)>`, for any two lifetimes `'0` and `'1`... +note: closure with signature `fn(&'0 _) -> Iter<'_, i32>` must implement `FnOnce<(&'1 Vec,)>`, for any two lifetimes `'0` and `'1`... + --> $DIR/higher-ranked-auto-trait-15.rs:16:20 + | +LL | fn require_send(_x: T) {} + | ------------ ^^^^ unsatisfied where-clause on `require_send` + | | + | due to a where-clause on `require_send` = note: ...but it actually implements `FnOnce<(&Vec,)>` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` help: consider adding an explicit type annotation to the closure's argument diff --git a/tests/ui/async-await/higher-ranked-auto-trait-16.assumptions.stderr b/tests/ui/async-await/higher-ranked-auto-trait-16.assumptions.stderr index 69e356703c9f0..52c54f8355c39 100644 --- a/tests/ui/async-await/higher-ranked-auto-trait-16.assumptions.stderr +++ b/tests/ui/async-await/higher-ranked-auto-trait-16.assumptions.stderr @@ -1,33 +1,35 @@ error: implementation of `AsyncFnOnce` is not general enough --> $DIR/higher-ranked-auto-trait-16.rs:18:5 | -LL | fn assert_send(_: T) {} - | ----------- ---- unsatisfied where-clause on `assert_send` - | | - | due to a where-clause on `assert_send`... -... LL | / assert_send(async { LL | | commit_if_ok(&mut ctxt, async |_| todo!()).await; LL | | }); | |______^ | - = note: ...`{async closure@...}` must implement `AsyncFnOnce<(&mut Ctxt<'1>,)>`, for any two lifetimes `'0` and `'1`... +note: `{async closure@...}` must implement `AsyncFnOnce<(&mut Ctxt<'1>,)>`, for any two lifetimes `'0` and `'1`... + --> $DIR/higher-ranked-auto-trait-16.rs:8:19 + | +LL | fn assert_send(_: T) {} + | ----------- ^^^^ unsatisfied where-clause on `assert_send` + | | + | due to a where-clause on `assert_send` = note: ...but it actually implements `AsyncFnOnce<(&mut Ctxt<'_>,)>` error: implementation of `AsyncFnOnce` is not general enough --> $DIR/higher-ranked-auto-trait-16.rs:18:5 | -LL | fn assert_send(_: T) {} - | ----------- ---- unsatisfied where-clause on `assert_send` - | | - | due to a where-clause on `assert_send`... -... LL | / assert_send(async { LL | | commit_if_ok(&mut ctxt, async |_| todo!()).await; LL | | }); | |______^ | - = note: ...`{async closure@...}` must implement `AsyncFnOnce<(&mut Ctxt<'1>,)>`, for any two lifetimes `'0` and `'1`... +note: `{async closure@...}` must implement `AsyncFnOnce<(&mut Ctxt<'1>,)>`, for any two lifetimes `'0` and `'1`... + --> $DIR/higher-ranked-auto-trait-16.rs:8:19 + | +LL | fn assert_send(_: T) {} + | ----------- ^^^^ unsatisfied where-clause on `assert_send` + | | + | due to a where-clause on `assert_send` = note: ...but it actually implements `AsyncFnOnce<(&mut Ctxt<'_>,)>` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` diff --git a/tests/ui/async-await/higher-ranked-auto-trait-16.no_assumptions.stderr b/tests/ui/async-await/higher-ranked-auto-trait-16.no_assumptions.stderr index 69e356703c9f0..52c54f8355c39 100644 --- a/tests/ui/async-await/higher-ranked-auto-trait-16.no_assumptions.stderr +++ b/tests/ui/async-await/higher-ranked-auto-trait-16.no_assumptions.stderr @@ -1,33 +1,35 @@ error: implementation of `AsyncFnOnce` is not general enough --> $DIR/higher-ranked-auto-trait-16.rs:18:5 | -LL | fn assert_send(_: T) {} - | ----------- ---- unsatisfied where-clause on `assert_send` - | | - | due to a where-clause on `assert_send`... -... LL | / assert_send(async { LL | | commit_if_ok(&mut ctxt, async |_| todo!()).await; LL | | }); | |______^ | - = note: ...`{async closure@...}` must implement `AsyncFnOnce<(&mut Ctxt<'1>,)>`, for any two lifetimes `'0` and `'1`... +note: `{async closure@...}` must implement `AsyncFnOnce<(&mut Ctxt<'1>,)>`, for any two lifetimes `'0` and `'1`... + --> $DIR/higher-ranked-auto-trait-16.rs:8:19 + | +LL | fn assert_send(_: T) {} + | ----------- ^^^^ unsatisfied where-clause on `assert_send` + | | + | due to a where-clause on `assert_send` = note: ...but it actually implements `AsyncFnOnce<(&mut Ctxt<'_>,)>` error: implementation of `AsyncFnOnce` is not general enough --> $DIR/higher-ranked-auto-trait-16.rs:18:5 | -LL | fn assert_send(_: T) {} - | ----------- ---- unsatisfied where-clause on `assert_send` - | | - | due to a where-clause on `assert_send`... -... LL | / assert_send(async { LL | | commit_if_ok(&mut ctxt, async |_| todo!()).await; LL | | }); | |______^ | - = note: ...`{async closure@...}` must implement `AsyncFnOnce<(&mut Ctxt<'1>,)>`, for any two lifetimes `'0` and `'1`... +note: `{async closure@...}` must implement `AsyncFnOnce<(&mut Ctxt<'1>,)>`, for any two lifetimes `'0` and `'1`... + --> $DIR/higher-ranked-auto-trait-16.rs:8:19 + | +LL | fn assert_send(_: T) {} + | ----------- ^^^^ unsatisfied where-clause on `assert_send` + | | + | due to a where-clause on `assert_send` = note: ...but it actually implements `AsyncFnOnce<(&mut Ctxt<'_>,)>` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` diff --git a/tests/ui/async-await/higher-ranked-auto-trait-5.no_assumptions.stderr b/tests/ui/async-await/higher-ranked-auto-trait-5.no_assumptions.stderr index ef743392cb014..6119247429e28 100644 --- a/tests/ui/async-await/higher-ranked-auto-trait-5.no_assumptions.stderr +++ b/tests/ui/async-await/higher-ranked-auto-trait-5.no_assumptions.stderr @@ -5,14 +5,15 @@ LL | / assert_send(async { LL | | call_me.call().await; LL | | }); | |______^ -... -LL | pub fn assert_send(_future: F) - | ----------- due to a where-clause on `assert_send`... -LL | where -LL | F: Future + Send, - | ---- unsatisfied where-clause on `assert_send` | - = note: ...`Send` would have to be implemented for the type `&'0 str`, for any lifetime `'0`... +note: `Send` would have to be implemented for the type `&'0 str`, for any lifetime `'0`... + --> $DIR/higher-ranked-auto-trait-5.rs:20:17 + | +LL | pub fn assert_send(_future: F) + | ----------- due to a where-clause on `assert_send` +LL | where +LL | F: Future + Send, + | ^^^^ unsatisfied where-clause on `assert_send` = note: ...but `Send` is actually implemented for the type `&'1 str`, for some specific lifetime `'1` error: aborting due to 1 previous error diff --git a/tests/ui/async-await/return-type-notation/issue-110963-early.no_assumptions.stderr b/tests/ui/async-await/return-type-notation/issue-110963-early.no_assumptions.stderr index be635809f1db7..889d3c2948d61 100644 --- a/tests/ui/async-await/return-type-notation/issue-110963-early.no_assumptions.stderr +++ b/tests/ui/async-await/return-type-notation/issue-110963-early.no_assumptions.stderr @@ -11,14 +11,15 @@ LL | | log_health_check_failure().await; LL | | } LL | | }); | |______^ -... -LL | fn spawn(future: F) -> JoinHandle - | ----- due to a where-clause on `spawn`... -LL | where -LL | F: Future + Send + 'static, - | ---- unsatisfied where-clause on `spawn` | - = note: ...`Send` would have to be implemented for the type `impl Future { ::check<'0>(..) }`, for any two lifetimes `'0` and `'1`... +note: `Send` would have to be implemented for the type `impl Future { ::check<'0>(..) }`, for any two lifetimes `'0` and `'1`... + --> $DIR/issue-110963-early.rs:37:17 + | +LL | fn spawn(future: F) -> JoinHandle + | ----- due to a where-clause on `spawn` +LL | where +LL | F: Future + Send + 'static, + | ^^^^ unsatisfied where-clause on `spawn` = note: ...but `Send` is actually implemented for the type `impl Future { ::check<'2>(..) }`, for some specific lifetime `'2` error: implementation of `Send` is not general enough @@ -34,14 +35,15 @@ LL | | log_health_check_failure().await; LL | | } LL | | }); | |______^ -... -LL | fn spawn(future: F) -> JoinHandle - | ----- due to a where-clause on `spawn`... -LL | where -LL | F: Future + Send + 'static, - | ---- unsatisfied where-clause on `spawn` | - = note: ...`Send` would have to be implemented for the type `impl Future { ::check<'0>(..) }`, for any two lifetimes `'0` and `'1`... +note: `Send` would have to be implemented for the type `impl Future { ::check<'0>(..) }`, for any two lifetimes `'0` and `'1`... + --> $DIR/issue-110963-early.rs:37:17 + | +LL | fn spawn(future: F) -> JoinHandle + | ----- due to a where-clause on `spawn` +LL | where +LL | F: Future + Send + 'static, + | ^^^^ unsatisfied where-clause on `spawn` = note: ...but `Send` is actually implemented for the type `impl Future { ::check<'2>(..) }`, for some specific lifetime `'2` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` diff --git a/tests/ui/borrowck/implementation-not-general-enough-ice-133252.stderr b/tests/ui/borrowck/implementation-not-general-enough-ice-133252.stderr index b5ea0003b1d63..beb349c94bd1a 100644 --- a/tests/ui/borrowck/implementation-not-general-enough-ice-133252.stderr +++ b/tests/ui/borrowck/implementation-not-general-enough-ice-133252.stderr @@ -3,13 +3,14 @@ error: implementation of `LoadQuery` is not general enough | LL | force_send(async_load(¬_static)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -... + | +note: `LoadQuery<'0>` would have to be implemented for the type `&u8`, for any lifetime `'0`... + --> $DIR/implementation-not-general-enough-ice-133252.rs:16:18 + | LL | fn force_send(_: T) {} - | ---------- ---- unsatisfied where-clause on `force_send` + | ---------- ^^^^ unsatisfied where-clause on `force_send` | | - | due to a where-clause on `force_send`... - | - = note: ...`LoadQuery<'0>` would have to be implemented for the type `&u8`, for any lifetime `'0`... + | due to a where-clause on `force_send` = note: ...but `LoadQuery<'1>` is actually implemented for the type `&'1 u8`, for some specific lifetime `'1` error[E0597]: `not_static` does not live long enough diff --git a/tests/ui/closures/deduce-signature/obligation-with-leaking-placeholders.current.stderr b/tests/ui/closures/deduce-signature/obligation-with-leaking-placeholders.current.stderr index f7f000992c06c..5f8198ec6bed9 100644 --- a/tests/ui/closures/deduce-signature/obligation-with-leaking-placeholders.current.stderr +++ b/tests/ui/closures/deduce-signature/obligation-with-leaking-placeholders.current.stderr @@ -1,12 +1,6 @@ error: implementation of `Foo` is not general enough --> $DIR/obligation-with-leaking-placeholders.rs:18:5 | -LL | fn needs_foo(_: T) - | --------- due to a where-clause on `needs_foo`... -LL | where -LL | for<'a> Wrap: Foo<'a>, - | ------- unsatisfied where-clause on `needs_foo` -... LL | / needs_foo(|x| { LL | | LL | | @@ -14,7 +8,14 @@ LL | | x.to_string(); LL | | }); | |______^ | - = note: ...`Wrap<{closure@...}>` must implement `Foo<'0>`, for any lifetime `'0`... +note: `Wrap<{closure@...}>` must implement `Foo<'0>`, for any lifetime `'0`... + --> $DIR/obligation-with-leaking-placeholders.rs:10:22 + | +LL | fn needs_foo(_: T) + | --------- due to a where-clause on `needs_foo` +LL | where +LL | for<'a> Wrap: Foo<'a>, + | ^^^^^^^ unsatisfied where-clause on `needs_foo` note: ...but it actually implements `Foo<'1>`, for some specific lifetime `'1` --> $DIR/obligation-with-leaking-placeholders.rs:15:1 | diff --git a/tests/ui/closures/hrtb-closure-suggest-type-annotation.stderr b/tests/ui/closures/hrtb-closure-suggest-type-annotation.stderr index b918a5c5179c8..5f7636bb34a0e 100644 --- a/tests/ui/closures/hrtb-closure-suggest-type-annotation.stderr +++ b/tests/ui/closures/hrtb-closure-suggest-type-annotation.stderr @@ -1,16 +1,17 @@ error: implementation of `FnOnce` is not general enough --> $DIR/hrtb-closure-suggest-type-annotation.rs:33:5 | -LL | fn inner(buf: &mut [u8], func: F) -> usize - | ----- due to a where-clause on `inner`... -LL | where -LL | F: FnOnce(&mut [u8]) -> Result, - | ----------------------------------------- unsatisfied where-clause on `inner` -... LL | inner(buf, outer_closure) | ^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: ...closure with signature `fn(&'2 mut [u8]) -> Result` must implement `FnOnce<(&'1 mut [u8],)>`, for any lifetime `'1`... +note: closure with signature `fn(&'2 mut [u8]) -> Result` must implement `FnOnce<(&'1 mut [u8],)>`, for any lifetime `'1`... + --> $DIR/hrtb-closure-suggest-type-annotation.rs:8:8 + | +LL | fn inner(buf: &mut [u8], func: F) -> usize + | ----- due to a where-clause on `inner` +LL | where +LL | F: FnOnce(&mut [u8]) -> Result, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unsatisfied where-clause on `inner` = note: ...but it actually implements `FnOnce<(&'2 mut [u8],)>`, for some specific lifetime `'2` help: consider adding an explicit type annotation to the closure's argument | @@ -20,16 +21,17 @@ LL | let outer_closure = |buf: &mut [u8]| { error: implementation of `FnOnce` is not general enough --> $DIR/hrtb-closure-suggest-type-annotation.rs:33:5 | -LL | fn inner(buf: &mut [u8], func: F) -> usize - | ----- due to a where-clause on `inner`... -LL | where -LL | F: FnOnce(&mut [u8]) -> Result, - | -------------------- unsatisfied where-clause on `inner` -... LL | inner(buf, outer_closure) | ^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: ...closure with signature `fn(&'2 mut [u8]) -> Result` must implement `FnOnce<(&'1 mut [u8],)>`, for any lifetime `'1`... +note: closure with signature `fn(&'2 mut [u8]) -> Result` must implement `FnOnce<(&'1 mut [u8],)>`, for any lifetime `'1`... + --> $DIR/hrtb-closure-suggest-type-annotation.rs:8:29 + | +LL | fn inner(buf: &mut [u8], func: F) -> usize + | ----- due to a where-clause on `inner` +LL | where +LL | F: FnOnce(&mut [u8]) -> Result, + | ^^^^^^^^^^^^^^^^^^^^ unsatisfied where-clause on `inner` = note: ...but it actually implements `FnOnce<(&'2 mut [u8],)>`, for some specific lifetime `'2` help: consider adding an explicit type annotation to the closure's argument | diff --git a/tests/ui/coroutine/auto-trait-regions.stderr b/tests/ui/coroutine/auto-trait-regions.stderr index 566f71d89c28d..25f6373124d34 100644 --- a/tests/ui/coroutine/auto-trait-regions.stderr +++ b/tests/ui/coroutine/auto-trait-regions.stderr @@ -1,18 +1,19 @@ error: implementation of `Foo` is not general enough --> $DIR/auto-trait-regions.rs:31:5 | -LL | fn assert_foo(f: T) {} - | ---------- --- unsatisfied where-clause on `assert_foo` - | | - | due to a where-clause on `assert_foo`... -... LL | let generator = #[coroutine] move || { | ------- this coroutine captures a value whose type is not `Foo` ... LL | assert_foo(generator); | ^^^^^^^^^^^^^^^^^^^^^ | - = note: ...`&'0 OnlyFooIfStaticRef` must implement `Foo`, for any lifetime `'0`... +note: `&'0 OnlyFooIfStaticRef` must implement `Foo`, for any lifetime `'0`... + --> $DIR/auto-trait-regions.rs:21:18 + | +LL | fn assert_foo(f: T) {} + | ---------- ^^^ unsatisfied where-clause on `assert_foo` + | | + | due to a where-clause on `assert_foo` = note: ...but `Foo` is actually implemented for the type `&'static OnlyFooIfStaticRef` error[E0626]: borrow may still be in use when coroutine yields @@ -50,18 +51,19 @@ LL | let generator = #[coroutine] static move || { error: implementation of `Foo` is not general enough --> $DIR/auto-trait-regions.rs:51:5 | -LL | fn assert_foo(f: T) {} - | ---------- --- unsatisfied where-clause on `assert_foo` - | | - | due to a where-clause on `assert_foo`... -... LL | let generator = #[coroutine] move || { | ------- this coroutine captures a value whose type is not `Foo` ... LL | assert_foo(generator); | ^^^^^^^^^^^^^^^^^^^^^ | - = note: ...`Foo` would have to be implemented for the type `A<'0, '1>`, for any two lifetimes `'0` and `'1`... +note: `Foo` would have to be implemented for the type `A<'0, '1>`, for any two lifetimes `'0` and `'1`... + --> $DIR/auto-trait-regions.rs:21:18 + | +LL | fn assert_foo(f: T) {} + | ---------- ^^^ unsatisfied where-clause on `assert_foo` + | | + | due to a where-clause on `assert_foo` = note: ...but `Foo` is actually implemented for the type `A<'_, '2>`, for some specific lifetime `'2` error: aborting due to 4 previous errors diff --git a/tests/ui/coroutine/resume-arg-late-bound.stderr b/tests/ui/coroutine/resume-arg-late-bound.stderr index bc1f1d29edd61..b44a8e363128f 100644 --- a/tests/ui/coroutine/resume-arg-late-bound.stderr +++ b/tests/ui/coroutine/resume-arg-late-bound.stderr @@ -1,15 +1,16 @@ error: implementation of `Coroutine` is not general enough --> $DIR/resume-arg-late-bound.rs:15:5 | -LL | fn test(a: impl for<'a> Coroutine<&'a mut bool>) {} - | ---- ------------------------------- unsatisfied where-clause on `test` - | | - | due to a where-clause on `test`... -... LL | test(gen); | ^^^^^^^^^ | - = note: ...`{coroutine@...}` must implement `Coroutine<&'1 mut bool>`, for any lifetime `'1`... +note: `{coroutine@...}` must implement `Coroutine<&'1 mut bool>`, for any lifetime `'1`... + --> $DIR/resume-arg-late-bound.rs:8:17 + | +LL | fn test(a: impl for<'a> Coroutine<&'a mut bool>) {} + | ---- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unsatisfied where-clause on `test` + | | + | due to a where-clause on `test` = note: ...but it actually implements `Coroutine<&'2 mut bool>`, for some specific lifetime `'2` error: aborting due to 1 previous error diff --git a/tests/ui/generic-associated-types/gat-bounds-not-checked-with-right-substitutions.stderr b/tests/ui/generic-associated-types/gat-bounds-not-checked-with-right-substitutions.stderr index 42aa33c0be186..92d39c70137ce 100644 --- a/tests/ui/generic-associated-types/gat-bounds-not-checked-with-right-substitutions.stderr +++ b/tests/ui/generic-associated-types/gat-bounds-not-checked-with-right-substitutions.stderr @@ -1,15 +1,16 @@ error: implementation of `Lengthen` is not general enough --> $DIR/gat-bounds-not-checked-with-right-substitutions.rs:20:20 | -LL | type Gat<'a>: for<'b> Lengthen>; - | --- ------------------------------- unsatisfied where-clause on `Gat::Gat` - | | - | due to a where-clause on `Gat::Gat`... -... LL | type Gat<'a> = &'a str; | ^^^^^^^ | - = note: ...`Lengthen<&'0 str>` would have to be implemented for the type `&'a str`, for any lifetime `'0`... +note: `Lengthen<&'0 str>` would have to be implemented for the type `&'a str`, for any lifetime `'0`... + --> $DIR/gat-bounds-not-checked-with-right-substitutions.rs:12:19 + | +LL | type Gat<'a>: for<'b> Lengthen>; + | --- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unsatisfied where-clause on `Gat::Gat` + | | + | due to a where-clause on `Gat::Gat` = note: ...but `Lengthen<&'1 str>` is actually implemented for the type `&'1 str`, for some specific lifetime `'1` note: required by a bound in `Gat::Gat` --> $DIR/gat-bounds-not-checked-with-right-substitutions.rs:12:19 diff --git a/tests/ui/higher-ranked/hr-fn-ptr-trait-impl-mismatch-29061.stderr b/tests/ui/higher-ranked/hr-fn-ptr-trait-impl-mismatch-29061.stderr index 7c3fcf47e6a40..16c1b69d3b053 100644 --- a/tests/ui/higher-ranked/hr-fn-ptr-trait-impl-mismatch-29061.stderr +++ b/tests/ui/higher-ranked/hr-fn-ptr-trait-impl-mismatch-29061.stderr @@ -1,43 +1,46 @@ error: implementation of `HR` is not general enough --> $DIR/hr-fn-ptr-trait-impl-mismatch-29061.rs:25:5 | -LL | fn hr(_: T) {} - | -- -- unsatisfied where-clause on `hr` - | | - | due to a where-clause on `hr`... -... LL | hr(not_hr_func); | ^^^^^^^^^^^^^^^ | - = note: ...`HR` would have to be implemented for the type `fn(&'0 ())`, for some specific lifetime `'0`... +note: `HR` would have to be implemented for the type `fn(&'0 ())`, for some specific lifetime `'0`... + --> $DIR/hr-fn-ptr-trait-impl-mismatch-29061.rs:15:10 + | +LL | fn hr(_: T) {} + | -- ^^ unsatisfied where-clause on `hr` + | | + | due to a where-clause on `hr` = note: ...but `HR` is actually implemented for the type `for<'a> fn(&'a ())` error: implementation of `NotHR` is not general enough --> $DIR/hr-fn-ptr-trait-impl-mismatch-29061.rs:27:5 | -LL | fn not_hr(_: T) {} - | ------ ----- unsatisfied where-clause on `not_hr` - | | - | due to a where-clause on `not_hr`... -... LL | not_hr(hr_func); | ^^^^^^^^^^^^^^^ | - = note: ...`NotHR` would have to be implemented for the type `for<'a> fn(&'a ())` +note: `NotHR` would have to be implemented for the type `for<'a> fn(&'a ())` + --> $DIR/hr-fn-ptr-trait-impl-mismatch-29061.rs:19:14 + | +LL | fn not_hr(_: T) {} + | ------ ^^^^^ unsatisfied where-clause on `not_hr` + | | + | due to a where-clause on `not_hr` = note: ...but `NotHR` is actually implemented for the type `fn(&'0 ())`, for some specific lifetime `'0` error: implementation of `NotHR` is not general enough --> $DIR/hr-fn-ptr-trait-impl-mismatch-29061.rs:29:5 | -LL | fn not_hr(_: T) {} - | ------ ----- unsatisfied where-clause on `not_hr` - | | - | due to a where-clause on `not_hr`... -... LL | not_hr(hr_func2); | ^^^^^^^^^^^^^^^^ | - = note: ...`NotHR` would have to be implemented for the type `for<'b> fn(&'b ())` +note: `NotHR` would have to be implemented for the type `for<'b> fn(&'b ())` + --> $DIR/hr-fn-ptr-trait-impl-mismatch-29061.rs:19:14 + | +LL | fn not_hr(_: T) {} + | ------ ^^^^^ unsatisfied where-clause on `not_hr` + | | + | due to a where-clause on `not_hr` = note: ...but `NotHR` is actually implemented for the type `fn(&'0 ())`, for some specific lifetime `'0` error: aborting due to 3 previous errors diff --git a/tests/ui/higher-ranked/hrtb-associated-type-leak-check-55731.stderr b/tests/ui/higher-ranked/hrtb-associated-type-leak-check-55731.stderr index eaa82c3f77871..d3e10e7a18d20 100644 --- a/tests/ui/higher-ranked/hrtb-associated-type-leak-check-55731.stderr +++ b/tests/ui/higher-ranked/hrtb-associated-type-leak-check-55731.stderr @@ -1,19 +1,20 @@ error: implementation of `DistributedIteratorMulti` is not general enough --> $DIR/hrtb-associated-type-leak-check-55731.rs:49:5 | -LL | fn multi(_reducer: I) - | ----- due to a where-clause on `multi`... -LL | where -LL | I: for<'a> DistributedIteratorMulti<&'a ()>, - | ---------------------------------------- unsatisfied where-clause on `multi` -... LL | / multi(Map { LL | | i: Cloned(PhantomData), LL | | f: X, LL | | }); | |______^ | - = note: ...`DistributedIteratorMulti<&'0 ()>` would have to be implemented for the type `Cloned<&()>`, for any lifetime `'0`... +note: `DistributedIteratorMulti<&'0 ()>` would have to be implemented for the type `Cloned<&()>`, for any lifetime `'0`... + --> $DIR/hrtb-associated-type-leak-check-55731.rs:43:8 + | +LL | fn multi(_reducer: I) + | ----- due to a where-clause on `multi` +LL | where +LL | I: for<'a> DistributedIteratorMulti<&'a ()>, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unsatisfied where-clause on `multi` = note: ...but `DistributedIteratorMulti<&'1 ()>` is actually implemented for the type `Cloned<&'1 ()>`, for some specific lifetime `'1` error: aborting due to 1 previous error diff --git a/tests/ui/higher-ranked/hrtb-fn-ptr-impl-not-general-enough-57936.stderr b/tests/ui/higher-ranked/hrtb-fn-ptr-impl-not-general-enough-57936.stderr index afed0bca3fffe..f7a9020c59e24 100644 --- a/tests/ui/higher-ranked/hrtb-fn-ptr-impl-not-general-enough-57936.stderr +++ b/tests/ui/higher-ranked/hrtb-fn-ptr-impl-not-general-enough-57936.stderr @@ -14,15 +14,16 @@ LL | trait X { error: implementation of `X` is not general enough --> $DIR/hrtb-fn-ptr-impl-not-general-enough-57936.rs:26:5 | -LL | fn indirect() { - | -------- - unsatisfied where-clause on `indirect` - | | - | due to a where-clause on `indirect`... -... LL | indirect::(); | ^^^^^^^^^^^^^^^^^^^^^ | - = note: ...`X` would have to be implemented for the type `for<'a> fn(&'a ())` +note: `X` would have to be implemented for the type `for<'a> fn(&'a ())` + --> $DIR/hrtb-fn-ptr-impl-not-general-enough-57936.rs:21:16 + | +LL | fn indirect() { + | -------- ^ unsatisfied where-clause on `indirect` + | | + | due to a where-clause on `indirect` = note: ...but `X` is actually implemented for the type `fn(&'0 ())`, for some specific lifetime `'0` error: aborting due to 2 previous errors diff --git a/tests/ui/higher-ranked/trait-bounds/hrtb-conflate-regions.stderr b/tests/ui/higher-ranked/trait-bounds/hrtb-conflate-regions.stderr index 4111d1f82a89c..6700778198712 100644 --- a/tests/ui/higher-ranked/trait-bounds/hrtb-conflate-regions.stderr +++ b/tests/ui/higher-ranked/trait-bounds/hrtb-conflate-regions.stderr @@ -1,15 +1,16 @@ error: implementation of `Foo` is not general enough --> $DIR/hrtb-conflate-regions.rs:27:10 | -LL | fn want_foo2() - | --------- due to a where-clause on `want_foo2`... -LL | where T : for<'a,'b> Foo<(&'a isize, &'b isize)> - | -------------------------------------- unsatisfied where-clause on `want_foo2` -... LL | fn b() { want_foo2::(); } | ^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: ...`SomeStruct` must implement `Foo<(&'0 isize, &'1 isize)>`, for any two lifetimes `'0` and `'1`... +note: `SomeStruct` must implement `Foo<(&'0 isize, &'1 isize)>`, for any two lifetimes `'0` and `'1`... + --> $DIR/hrtb-conflate-regions.rs:9:15 + | +LL | fn want_foo2() + | --------- due to a where-clause on `want_foo2` +LL | where T : for<'a,'b> Foo<(&'a isize, &'b isize)> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unsatisfied where-clause on `want_foo2` note: ...but it actually implements `Foo<(&'2 isize, &'2 isize)>`, for some specific lifetime `'2` --> $DIR/hrtb-conflate-regions.rs:22:1 | @@ -19,15 +20,16 @@ LL | impl<'a> Foo<(&'a isize, &'a isize)> for SomeStruct error: implementation of `Foo` is not general enough --> $DIR/hrtb-conflate-regions.rs:27:10 | -LL | fn want_foo2() - | --------- due to a where-clause on `want_foo2`... -LL | where T : for<'a,'b> Foo<(&'a isize, &'b isize)> - | -------------------------------------- unsatisfied where-clause on `want_foo2` -... LL | fn b() { want_foo2::(); } | ^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: ...`SomeStruct` must implement `Foo<(&'0 isize, &'1 isize)>`, for any two lifetimes `'0` and `'1`... +note: `SomeStruct` must implement `Foo<(&'0 isize, &'1 isize)>`, for any two lifetimes `'0` and `'1`... + --> $DIR/hrtb-conflate-regions.rs:9:15 + | +LL | fn want_foo2() + | --------- due to a where-clause on `want_foo2` +LL | where T : for<'a,'b> Foo<(&'a isize, &'b isize)> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unsatisfied where-clause on `want_foo2` note: ...but it actually implements `Foo<(&'2 isize, &'2 isize)>`, for some specific lifetime `'2` --> $DIR/hrtb-conflate-regions.rs:22:1 | diff --git a/tests/ui/higher-ranked/trait-bounds/hrtb-exists-forall-trait-contravariant.stderr b/tests/ui/higher-ranked/trait-bounds/hrtb-exists-forall-trait-contravariant.stderr index d27bf6588cddf..e600c49d564be 100644 --- a/tests/ui/higher-ranked/trait-bounds/hrtb-exists-forall-trait-contravariant.stderr +++ b/tests/ui/higher-ranked/trait-bounds/hrtb-exists-forall-trait-contravariant.stderr @@ -1,16 +1,17 @@ error: implementation of `Trait` is not general enough --> $DIR/hrtb-exists-forall-trait-contravariant.rs:34:5 | -LL | fn foo() - | --- due to a where-clause on `foo`... -LL | where -LL | T: Trait fn(&'b u32)>, - | -------------------------- unsatisfied where-clause on `foo` -... LL | foo::<()>(); | ^^^^^^^^^^^ | - = note: ...`()` must implement `Trait fn(&'b u32)>` +note: `()` must implement `Trait fn(&'b u32)>` + --> $DIR/hrtb-exists-forall-trait-contravariant.rs:10:8 + | +LL | fn foo() + | --- due to a where-clause on `foo` +LL | where +LL | T: Trait fn(&'b u32)>, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ unsatisfied where-clause on `foo` note: ...but it actually implements `Trait`, for some specific lifetime `'0` --> $DIR/hrtb-exists-forall-trait-contravariant.rs:14:1 | diff --git a/tests/ui/higher-ranked/trait-bounds/hrtb-exists-forall-trait-covariant.stderr b/tests/ui/higher-ranked/trait-bounds/hrtb-exists-forall-trait-covariant.stderr index 0fd20dbb3f0e5..dd720d9989060 100644 --- a/tests/ui/higher-ranked/trait-bounds/hrtb-exists-forall-trait-covariant.stderr +++ b/tests/ui/higher-ranked/trait-bounds/hrtb-exists-forall-trait-covariant.stderr @@ -1,16 +1,17 @@ error: implementation of `Trait` is not general enough --> $DIR/hrtb-exists-forall-trait-covariant.rs:33:5 | -LL | fn foo() - | --- due to a where-clause on `foo`... -LL | where -LL | T: Trait fn(fn(&'b u32))>, - | ------------------------------ unsatisfied where-clause on `foo` -... LL | foo::<()>(); | ^^^^^^^^^^^ | - = note: ...`()` must implement `Trait fn(fn(&'b u32))>` +note: `()` must implement `Trait fn(fn(&'b u32))>` + --> $DIR/hrtb-exists-forall-trait-covariant.rs:10:8 + | +LL | fn foo() + | --- due to a where-clause on `foo` +LL | where +LL | T: Trait fn(fn(&'b u32))>, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unsatisfied where-clause on `foo` note: ...but it actually implements `Trait`, for some specific lifetime `'0` --> $DIR/hrtb-exists-forall-trait-covariant.rs:14:1 | diff --git a/tests/ui/higher-ranked/trait-bounds/hrtb-exists-forall-trait-invariant.stderr b/tests/ui/higher-ranked/trait-bounds/hrtb-exists-forall-trait-invariant.stderr index eaecabbf544e1..446a3102a0938 100644 --- a/tests/ui/higher-ranked/trait-bounds/hrtb-exists-forall-trait-invariant.stderr +++ b/tests/ui/higher-ranked/trait-bounds/hrtb-exists-forall-trait-invariant.stderr @@ -1,16 +1,17 @@ error: implementation of `Trait` is not general enough --> $DIR/hrtb-exists-forall-trait-invariant.rs:28:5 | -LL | fn foo() - | --- due to a where-clause on `foo`... -LL | where -LL | T: Trait fn(Cell<&'b u32>)>, - | -------------------------------- unsatisfied where-clause on `foo` -... LL | foo::<()>(); | ^^^^^^^^^^^ | - = note: ...`()` must implement `Trait fn(Cell<&'b u32>)>` +note: `()` must implement `Trait fn(Cell<&'b u32>)>` + --> $DIR/hrtb-exists-forall-trait-invariant.rs:12:8 + | +LL | fn foo() + | --- due to a where-clause on `foo` +LL | where +LL | T: Trait fn(Cell<&'b u32>)>, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unsatisfied where-clause on `foo` note: ...but it actually implements `Trait)>`, for some specific lifetime `'0` --> $DIR/hrtb-exists-forall-trait-invariant.rs:16:1 | diff --git a/tests/ui/higher-ranked/trait-bounds/hrtb-just-for-static.stderr b/tests/ui/higher-ranked/trait-bounds/hrtb-just-for-static.stderr index 1f33e65e7e715..cdfcd30d44fb2 100644 --- a/tests/ui/higher-ranked/trait-bounds/hrtb-just-for-static.stderr +++ b/tests/ui/higher-ranked/trait-bounds/hrtb-just-for-static.stderr @@ -1,15 +1,16 @@ error: implementation of `Foo` is not general enough --> $DIR/hrtb-just-for-static.rs:24:5 | -LL | fn want_hrtb() - | --------- due to a where-clause on `want_hrtb`... -LL | where T : for<'a> Foo<&'a isize> - | ---------------------- unsatisfied where-clause on `want_hrtb` -... LL | want_hrtb::() | ^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: ...`StaticInt` must implement `Foo<&'0 isize>`, for any lifetime `'0`... +note: `StaticInt` must implement `Foo<&'0 isize>`, for any lifetime `'0`... + --> $DIR/hrtb-just-for-static.rs:9:15 + | +LL | fn want_hrtb() + | --------- due to a where-clause on `want_hrtb` +LL | where T : for<'a> Foo<&'a isize> + | ^^^^^^^^^^^^^^^^^^^^^^ unsatisfied where-clause on `want_hrtb` note: ...but it actually implements `Foo<&'static isize>` --> $DIR/hrtb-just-for-static.rs:22:1 | diff --git a/tests/ui/higher-ranked/trait-bounds/hrtb-perfect-forwarding.stderr b/tests/ui/higher-ranked/trait-bounds/hrtb-perfect-forwarding.stderr index 2b68dced8af0d..da60e78d2f389 100644 --- a/tests/ui/higher-ranked/trait-bounds/hrtb-perfect-forwarding.stderr +++ b/tests/ui/higher-ranked/trait-bounds/hrtb-perfect-forwarding.stderr @@ -56,16 +56,17 @@ LL | T: for<'a> Foo<&'a isize> + Bar<&'b isize>, error: implementation of `Bar` is not general enough --> $DIR/hrtb-perfect-forwarding.rs:43:5 | -LL | fn foo_hrtb_bar_not<'b, T>(mut t: T) - | ---------------- due to a where-clause on `foo_hrtb_bar_not`... -LL | where -LL | T: for<'a> Foo<&'a isize> + Bar<&'b isize>, - | ---------------------- unsatisfied where-clause on `foo_hrtb_bar_not` -... LL | foo_hrtb_bar_not(&mut t); | ^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: ...`T` must implement `Bar<&'0 isize>`, for any lifetime `'0`... +note: `T` must implement `Bar<&'0 isize>`, for any lifetime `'0`... + --> $DIR/hrtb-perfect-forwarding.rs:37:8 + | +LL | fn foo_hrtb_bar_not<'b, T>(mut t: T) + | ---------------- due to a where-clause on `foo_hrtb_bar_not` +LL | where +LL | T: for<'a> Foo<&'a isize> + Bar<&'b isize>, + | ^^^^^^^^^^^^^^^^^^^^^^ unsatisfied where-clause on `foo_hrtb_bar_not` note: ...but it actually implements `Bar<&'1 isize>`, for some specific lifetime `'1` --> $DIR/hrtb-perfect-forwarding.rs:14:1 | diff --git a/tests/ui/higher-ranked/trait-bounds/issue-46989.stderr b/tests/ui/higher-ranked/trait-bounds/issue-46989.stderr index e1d900f20ce3b..23cba27a2fc00 100644 --- a/tests/ui/higher-ranked/trait-bounds/issue-46989.stderr +++ b/tests/ui/higher-ranked/trait-bounds/issue-46989.stderr @@ -1,15 +1,16 @@ error: implementation of `Foo` is not general enough --> $DIR/issue-46989.rs:38:5 | -LL | fn assert_foo() {} - | ---------- --- unsatisfied where-clause on `assert_foo` - | | - | due to a where-clause on `assert_foo`... -... LL | assert_foo::(); | ^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: ...`Foo` would have to be implemented for the type `for<'a> fn(&'a i32)` +note: `Foo` would have to be implemented for the type `for<'a> fn(&'a i32)` + --> $DIR/issue-46989.rs:35:18 + | +LL | fn assert_foo() {} + | ---------- ^^^ unsatisfied where-clause on `assert_foo` + | | + | due to a where-clause on `assert_foo` = note: ...but `Foo` is actually implemented for the type `fn(&'0 i32)`, for some specific lifetime `'0` error: aborting due to 1 previous error diff --git a/tests/ui/higher-ranked/trait-bounds/issue-59311.stderr b/tests/ui/higher-ranked/trait-bounds/issue-59311.stderr index f7b72ec65db3f..9145a693c95c8 100644 --- a/tests/ui/higher-ranked/trait-bounds/issue-59311.stderr +++ b/tests/ui/higher-ranked/trait-bounds/issue-59311.stderr @@ -1,31 +1,33 @@ error: implementation of `Trait` is not general enough --> $DIR/issue-59311.rs:17:5 | -LL | pub fn crash(v: &V) - | ----- due to a where-clause on `crash`... -LL | where -LL | for<'a> &'a V: Trait + 'static, - | ----- unsatisfied where-clause on `crash` -LL | { LL | v.t(|| {}); | ^^^^^^^^^^ | - = note: ...`Trait` would have to be implemented for the type `&'a V` +note: `Trait` would have to be implemented for the type `&'a V` + --> $DIR/issue-59311.rs:15:20 + | +LL | pub fn crash(v: &V) + | ----- due to a where-clause on `crash` +LL | where +LL | for<'a> &'a V: Trait + 'static, + | ^^^^^ unsatisfied where-clause on `crash` = note: ...but `Trait` is actually implemented for the type `&'0 V`, for some specific lifetime `'0` error: implementation of `Trait` is not general enough --> $DIR/issue-59311.rs:17:5 | -LL | pub fn crash(v: &V) - | ----- due to a where-clause on `crash`... -LL | where -LL | for<'a> &'a V: Trait + 'static, - | ----- unsatisfied where-clause on `crash` -LL | { LL | v.t(|| {}); | ^^^^^^^^^^ | - = note: ...`Trait` would have to be implemented for the type `&'a V` +note: `Trait` would have to be implemented for the type `&'a V` + --> $DIR/issue-59311.rs:15:20 + | +LL | pub fn crash(v: &V) + | ----- due to a where-clause on `crash` +LL | where +LL | for<'a> &'a V: Trait + 'static, + | ^^^^^ unsatisfied where-clause on `crash` = note: ...but `Trait` is actually implemented for the type `&'0 V`, for some specific lifetime `'0` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` diff --git a/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/issue-71955.current.stderr b/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/issue-71955.current.stderr index 83a7a9836a1ad..6dd203ac806e5 100644 --- a/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/issue-71955.current.stderr +++ b/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/issue-71955.current.stderr @@ -1,16 +1,17 @@ error: implementation of `FnOnce` is not general enough --> $DIR/issue-71955.rs:47:5 | -LL | fn foo(f1: F1, f2: F2) - | --- due to a where-clause on `foo`... -... -LL | F2: for<'b, 'c> FnOnce(&'b >::Output) -> bool, - | ---------------------------------------------------------- unsatisfied where-clause on `foo` -... LL | foo(bar, |s| s.len() == 5); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: ...closure with signature `for<'a> fn(&'a &'2 str) -> bool` must implement `FnOnce<(&'b &'1 str,)>`, for any lifetime `'1`... +note: closure with signature `for<'a> fn(&'a &'2 str) -> bool` must implement `FnOnce<(&'b &'1 str,)>`, for any lifetime `'1`... + --> $DIR/issue-71955.rs:32:9 + | +LL | fn foo(f1: F1, f2: F2) + | --- due to a where-clause on `foo` +... +LL | F2: for<'b, 'c> FnOnce(&'b >::Output) -> bool, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unsatisfied where-clause on `foo` = note: ...but it actually implements `FnOnce<(&&'2 str,)>`, for some specific lifetime `'2` help: consider adding an explicit type annotation to the closure's argument | @@ -20,16 +21,17 @@ LL | foo(bar, |s: &'b &'c str| s.len() == 5); error: implementation of `FnOnce` is not general enough --> $DIR/issue-71955.rs:47:5 | -LL | fn foo(f1: F1, f2: F2) - | --- due to a where-clause on `foo`... -... -LL | F2: for<'b, 'c> FnOnce(&'b >::Output) -> bool, - | ---- unsatisfied where-clause on `foo` -... LL | foo(bar, |s| s.len() == 5); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: ...closure with signature `for<'a> fn(&'a &'2 str) -> bool` must implement `FnOnce<(&'b &'1 str,)>`, for any lifetime `'1`... +note: closure with signature `for<'a> fn(&'a &'2 str) -> bool` must implement `FnOnce<(&'b &'1 str,)>`, for any lifetime `'1`... + --> $DIR/issue-71955.rs:32:63 + | +LL | fn foo(f1: F1, f2: F2) + | --- due to a where-clause on `foo` +... +LL | F2: for<'b, 'c> FnOnce(&'b >::Output) -> bool, + | ^^^^ unsatisfied where-clause on `foo` = note: ...but it actually implements `FnOnce<(&&'2 str,)>`, for some specific lifetime `'2` help: consider adding an explicit type annotation to the closure's argument | @@ -39,16 +41,17 @@ LL | foo(bar, |s: &'b &'c str| s.len() == 5); error: implementation of `FnOnce` is not general enough --> $DIR/issue-71955.rs:50:5 | -LL | fn foo(f1: F1, f2: F2) - | --- due to a where-clause on `foo`... -... -LL | F2: for<'b, 'c> FnOnce(&'b >::Output) -> bool, - | ---------------------------------------------------------- unsatisfied where-clause on `foo` -... LL | foo(baz, |s| s.0.len() == 5); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: ...closure with signature `for<'a> fn(&'a Wrapper<'2>) -> bool` must implement `FnOnce<(&'b Wrapper<'1>,)>`, for any lifetime `'1`... +note: closure with signature `for<'a> fn(&'a Wrapper<'2>) -> bool` must implement `FnOnce<(&'b Wrapper<'1>,)>`, for any lifetime `'1`... + --> $DIR/issue-71955.rs:32:9 + | +LL | fn foo(f1: F1, f2: F2) + | --- due to a where-clause on `foo` +... +LL | F2: for<'b, 'c> FnOnce(&'b >::Output) -> bool, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unsatisfied where-clause on `foo` = note: ...but it actually implements `FnOnce<(&Wrapper<'2>,)>`, for some specific lifetime `'2` help: consider adding an explicit type annotation to the closure's argument | @@ -58,16 +61,17 @@ LL | foo(baz, |s: &'b Wrapper<'c>| s.0.len() == 5); error: implementation of `FnOnce` is not general enough --> $DIR/issue-71955.rs:50:5 | -LL | fn foo(f1: F1, f2: F2) - | --- due to a where-clause on `foo`... -... -LL | F2: for<'b, 'c> FnOnce(&'b >::Output) -> bool, - | ---- unsatisfied where-clause on `foo` -... LL | foo(baz, |s| s.0.len() == 5); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: ...closure with signature `for<'a> fn(&'a Wrapper<'2>) -> bool` must implement `FnOnce<(&'b Wrapper<'1>,)>`, for any lifetime `'1`... +note: closure with signature `for<'a> fn(&'a Wrapper<'2>) -> bool` must implement `FnOnce<(&'b Wrapper<'1>,)>`, for any lifetime `'1`... + --> $DIR/issue-71955.rs:32:63 + | +LL | fn foo(f1: F1, f2: F2) + | --- due to a where-clause on `foo` +... +LL | F2: for<'b, 'c> FnOnce(&'b >::Output) -> bool, + | ^^^^ unsatisfied where-clause on `foo` = note: ...but it actually implements `FnOnce<(&Wrapper<'2>,)>`, for some specific lifetime `'2` help: consider adding an explicit type annotation to the closure's argument | diff --git a/tests/ui/lifetimes/issue-105675.stderr b/tests/ui/lifetimes/issue-105675.stderr index 18960ff575a2a..995c3604ca6e0 100644 --- a/tests/ui/lifetimes/issue-105675.stderr +++ b/tests/ui/lifetimes/issue-105675.stderr @@ -1,15 +1,16 @@ error: implementation of `FnOnce` is not general enough --> $DIR/issue-105675.rs:5:5 | -LL | fn thing(x: impl FnOnce(&u32, &u32, u32)) {} - | ----- ----------------------- unsatisfied where-clause on `thing` - | | - | due to a where-clause on `thing`... -... LL | thing(f); | ^^^^^^^^ | - = note: ...closure with signature `for<'a> fn(&'2 u32, &'a u32, u32)` must implement `FnOnce<(&'1 u32, &u32, u32)>`, for any lifetime `'1`... +note: closure with signature `for<'a> fn(&'2 u32, &'a u32, u32)` must implement `FnOnce<(&'1 u32, &u32, u32)>`, for any lifetime `'1`... + --> $DIR/issue-105675.rs:1:18 + | +LL | fn thing(x: impl FnOnce(&u32, &u32, u32)) {} + | ----- ^^^^^^^^^^^^^^^^^^^^^^^ unsatisfied where-clause on `thing` + | | + | due to a where-clause on `thing` = note: ...but it actually implements `FnOnce<(&'2 u32, &u32, u32)>`, for some specific lifetime `'2` help: consider adding explicit type annotations to the closure's arguments | @@ -19,15 +20,16 @@ LL | let f = | _: &u32 , y: &u32 , z: u32 | (); error: implementation of `FnOnce` is not general enough --> $DIR/issue-105675.rs:5:5 | -LL | fn thing(x: impl FnOnce(&u32, &u32, u32)) {} - | ----- ----------------------- unsatisfied where-clause on `thing` - | | - | due to a where-clause on `thing`... -... LL | thing(f); | ^^^^^^^^ | - = note: ...closure with signature `for<'a> fn(&'2 u32, &'a u32, u32)` must implement `FnOnce<(&'1 u32, &u32, u32)>`, for any lifetime `'1`... +note: closure with signature `for<'a> fn(&'2 u32, &'a u32, u32)` must implement `FnOnce<(&'1 u32, &u32, u32)>`, for any lifetime `'1`... + --> $DIR/issue-105675.rs:1:18 + | +LL | fn thing(x: impl FnOnce(&u32, &u32, u32)) {} + | ----- ^^^^^^^^^^^^^^^^^^^^^^^ unsatisfied where-clause on `thing` + | | + | due to a where-clause on `thing` = note: ...but it actually implements `FnOnce<(&'2 u32, &u32, u32)>`, for some specific lifetime `'2` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` help: consider adding explicit type annotations to the closure's arguments @@ -38,15 +40,16 @@ LL | let f = | _: &u32 , y: &u32 , z: u32 | (); error: implementation of `FnOnce` is not general enough --> $DIR/issue-105675.rs:9:5 | -LL | fn thing(x: impl FnOnce(&u32, &u32, u32)) {} - | ----- ----------------------- unsatisfied where-clause on `thing` - | | - | due to a where-clause on `thing`... -... LL | thing(f); | ^^^^^^^^ | - = note: ...closure with signature `fn(&'2 u32, &u32, u32)` must implement `FnOnce<(&'1 u32, &u32, u32)>`, for any lifetime `'1`... +note: closure with signature `fn(&'2 u32, &u32, u32)` must implement `FnOnce<(&'1 u32, &u32, u32)>`, for any lifetime `'1`... + --> $DIR/issue-105675.rs:1:18 + | +LL | fn thing(x: impl FnOnce(&u32, &u32, u32)) {} + | ----- ^^^^^^^^^^^^^^^^^^^^^^^ unsatisfied where-clause on `thing` + | | + | due to a where-clause on `thing` = note: ...but it actually implements `FnOnce<(&'2 u32, &u32, u32)>`, for some specific lifetime `'2` help: consider adding an explicit type annotation to the closure's argument | @@ -56,15 +59,16 @@ LL | let f = | x: &u32, y: _ , z: u32 | (); error: implementation of `FnOnce` is not general enough --> $DIR/issue-105675.rs:9:5 | -LL | fn thing(x: impl FnOnce(&u32, &u32, u32)) {} - | ----- ----------------------- unsatisfied where-clause on `thing` - | | - | due to a where-clause on `thing`... -... LL | thing(f); | ^^^^^^^^ | - = note: ...closure with signature `fn(&u32, &'2 u32, u32)` must implement `FnOnce<(&u32, &'1 u32, u32)>`, for any lifetime `'1`... +note: closure with signature `fn(&u32, &'2 u32, u32)` must implement `FnOnce<(&u32, &'1 u32, u32)>`, for any lifetime `'1`... + --> $DIR/issue-105675.rs:1:18 + | +LL | fn thing(x: impl FnOnce(&u32, &u32, u32)) {} + | ----- ^^^^^^^^^^^^^^^^^^^^^^^ unsatisfied where-clause on `thing` + | | + | due to a where-clause on `thing` = note: ...but it actually implements `FnOnce<(&u32, &'2 u32, u32)>`, for some specific lifetime `'2` help: consider adding an explicit type annotation to the closure's argument | @@ -74,15 +78,16 @@ LL | let f = | x: &u32, y: _ , z: u32 | (); error: implementation of `FnOnce` is not general enough --> $DIR/issue-105675.rs:9:5 | -LL | fn thing(x: impl FnOnce(&u32, &u32, u32)) {} - | ----- ----------------------- unsatisfied where-clause on `thing` - | | - | due to a where-clause on `thing`... -... LL | thing(f); | ^^^^^^^^ | - = note: ...closure with signature `fn(&'2 u32, &u32, u32)` must implement `FnOnce<(&'1 u32, &u32, u32)>`, for any lifetime `'1`... +note: closure with signature `fn(&'2 u32, &u32, u32)` must implement `FnOnce<(&'1 u32, &u32, u32)>`, for any lifetime `'1`... + --> $DIR/issue-105675.rs:1:18 + | +LL | fn thing(x: impl FnOnce(&u32, &u32, u32)) {} + | ----- ^^^^^^^^^^^^^^^^^^^^^^^ unsatisfied where-clause on `thing` + | | + | due to a where-clause on `thing` = note: ...but it actually implements `FnOnce<(&'2 u32, &u32, u32)>`, for some specific lifetime `'2` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` help: consider adding an explicit type annotation to the closure's argument @@ -93,15 +98,16 @@ LL | let f = | x: &u32, y: _ , z: u32 | (); error: implementation of `FnOnce` is not general enough --> $DIR/issue-105675.rs:9:5 | -LL | fn thing(x: impl FnOnce(&u32, &u32, u32)) {} - | ----- ----------------------- unsatisfied where-clause on `thing` - | | - | due to a where-clause on `thing`... -... LL | thing(f); | ^^^^^^^^ | - = note: ...closure with signature `fn(&u32, &'2 u32, u32)` must implement `FnOnce<(&u32, &'1 u32, u32)>`, for any lifetime `'1`... +note: closure with signature `fn(&u32, &'2 u32, u32)` must implement `FnOnce<(&u32, &'1 u32, u32)>`, for any lifetime `'1`... + --> $DIR/issue-105675.rs:1:18 + | +LL | fn thing(x: impl FnOnce(&u32, &u32, u32)) {} + | ----- ^^^^^^^^^^^^^^^^^^^^^^^ unsatisfied where-clause on `thing` + | | + | due to a where-clause on `thing` = note: ...but it actually implements `FnOnce<(&u32, &'2 u32, u32)>`, for some specific lifetime `'2` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` help: consider adding an explicit type annotation to the closure's argument diff --git a/tests/ui/lifetimes/issue-79187-2.stderr b/tests/ui/lifetimes/issue-79187-2.stderr index 7029eeafef0eb..4b2799812fe90 100644 --- a/tests/ui/lifetimes/issue-79187-2.stderr +++ b/tests/ui/lifetimes/issue-79187-2.stderr @@ -1,15 +1,16 @@ error: implementation of `FnOnce` is not general enough --> $DIR/issue-79187-2.rs:8:5 | -LL | fn take_foo(_: impl Foo) {} - | -------- --- unsatisfied where-clause on `take_foo` - | | - | due to a where-clause on `take_foo`... -... LL | take_foo(|a| a); | ^^^^^^^^^^^^^^^ | - = note: ...closure with signature `fn(&'2 i32) -> &i32` must implement `FnOnce<(&'1 i32,)>`, for any lifetime `'1`... +note: closure with signature `fn(&'2 i32) -> &i32` must implement `FnOnce<(&'1 i32,)>`, for any lifetime `'1`... + --> $DIR/issue-79187-2.rs:5:21 + | +LL | fn take_foo(_: impl Foo) {} + | -------- ^^^ unsatisfied where-clause on `take_foo` + | | + | due to a where-clause on `take_foo` = note: ...but it actually implements `FnOnce<(&'2 i32,)>`, for some specific lifetime `'2` help: consider adding an explicit type annotation to the closure's argument | @@ -19,15 +20,16 @@ LL | take_foo(|a: &i32| a); error: implementation of `Fn` is not general enough --> $DIR/issue-79187-2.rs:8:5 | -LL | fn take_foo(_: impl Foo) {} - | -------- --- unsatisfied where-clause on `take_foo` - | | - | due to a where-clause on `take_foo`... -... LL | take_foo(|a| a); | ^^^^^^^^^^^^^^^ | - = note: ...closure with signature `fn(&'2 i32) -> &i32` must implement `Fn<(&'1 i32,)>`, for any lifetime `'1`... +note: closure with signature `fn(&'2 i32) -> &i32` must implement `Fn<(&'1 i32,)>`, for any lifetime `'1`... + --> $DIR/issue-79187-2.rs:5:21 + | +LL | fn take_foo(_: impl Foo) {} + | -------- ^^^ unsatisfied where-clause on `take_foo` + | | + | due to a where-clause on `take_foo` = note: ...but it actually implements `Fn<(&'2 i32,)>`, for some specific lifetime `'2` help: consider adding an explicit type annotation to the closure's argument | diff --git a/tests/ui/lifetimes/issue-79187.stderr b/tests/ui/lifetimes/issue-79187.stderr index 3dbb6054a7ad3..2377c4d5ba5f3 100644 --- a/tests/ui/lifetimes/issue-79187.stderr +++ b/tests/ui/lifetimes/issue-79187.stderr @@ -1,15 +1,16 @@ error: implementation of `FnOnce` is not general enough --> $DIR/issue-79187.rs:5:5 | -LL | fn thing(x: impl FnOnce(&u32)) {} - | ----- ------------ unsatisfied where-clause on `thing` - | | - | due to a where-clause on `thing`... -... LL | thing(f); | ^^^^^^^^ | - = note: ...closure with signature `fn(&'2 u32)` must implement `FnOnce<(&'1 u32,)>`, for any lifetime `'1`... +note: closure with signature `fn(&'2 u32)` must implement `FnOnce<(&'1 u32,)>`, for any lifetime `'1`... + --> $DIR/issue-79187.rs:1:18 + | +LL | fn thing(x: impl FnOnce(&u32)) {} + | ----- ^^^^^^^^^^^^ unsatisfied where-clause on `thing` + | | + | due to a where-clause on `thing` = note: ...but it actually implements `FnOnce<(&'2 u32,)>`, for some specific lifetime `'2` help: consider adding an explicit type annotation to the closure's argument | @@ -19,15 +20,16 @@ LL | let f = |_: &u32| (); error: implementation of `FnOnce` is not general enough --> $DIR/issue-79187.rs:5:5 | -LL | fn thing(x: impl FnOnce(&u32)) {} - | ----- ------------ unsatisfied where-clause on `thing` - | | - | due to a where-clause on `thing`... -... LL | thing(f); | ^^^^^^^^ | - = note: ...closure with signature `fn(&'2 u32)` must implement `FnOnce<(&'1 u32,)>`, for any lifetime `'1`... +note: closure with signature `fn(&'2 u32)` must implement `FnOnce<(&'1 u32,)>`, for any lifetime `'1`... + --> $DIR/issue-79187.rs:1:18 + | +LL | fn thing(x: impl FnOnce(&u32)) {} + | ----- ^^^^^^^^^^^^ unsatisfied where-clause on `thing` + | | + | due to a where-clause on `thing` = note: ...but it actually implements `FnOnce<(&'2 u32,)>`, for some specific lifetime `'2` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` help: consider adding an explicit type annotation to the closure's argument diff --git a/tests/ui/lifetimes/lifetime-errors/issue_74400.stderr b/tests/ui/lifetimes/lifetime-errors/issue_74400.stderr index 3a293cc4b2516..5670dc4ea00f7 100644 --- a/tests/ui/lifetimes/lifetime-errors/issue_74400.stderr +++ b/tests/ui/lifetimes/lifetime-errors/issue_74400.stderr @@ -45,27 +45,29 @@ LL | fn g(data: &[T]) { error: implementation of `Fn` is not general enough --> $DIR/issue_74400.rs:12:5 | -LL | fn f(data: &[T], key: impl Fn(&T) -> S) { - | - ----------- unsatisfied where-clause on `f` - | | - | due to a where-clause on `f`... -... LL | f(data, identity) | ^^^^^^^^^^^^^^^^^ | - = note: ...`fn(&'2 T) -> &'2 T {identity::<&'2 T>}` must implement `Fn<(&'1 T,)>`, for any lifetime `'1`... +note: `fn(&'2 T) -> &'2 T {identity::<&'2 T>}` must implement `Fn<(&'1 T,)>`, for any lifetime `'1`... + --> $DIR/issue_74400.rs:8:34 + | +LL | fn f(data: &[T], key: impl Fn(&T) -> S) { + | - ^^^^^^^^^^^ unsatisfied where-clause on `f` + | | + | due to a where-clause on `f` = note: ...but it actually implements `Fn<(&'2 T,)>`, for some specific lifetime `'2` error: implementation of `FnOnce` is not general enough --> $DIR/issue_74400.rs:12:5 | -LL | fn f(data: &[T], key: impl Fn(&T) -> S) { - | - due to a where-clause on `f`... - unsatisfied where-clause on `f` -... LL | f(data, identity) | ^^^^^^^^^^^^^^^^^ | - = note: ...`fn(&'2 T) -> &'2 T {identity::<&'2 T>}` must implement `FnOnce<(&'1 T,)>`, for any lifetime `'1`... +note: `fn(&'2 T) -> &'2 T {identity::<&'2 T>}` must implement `FnOnce<(&'1 T,)>`, for any lifetime `'1`... + --> $DIR/issue_74400.rs:8:44 + | +LL | fn f(data: &[T], key: impl Fn(&T) -> S) { + | - due to a where-clause on `f` ^ unsatisfied where-clause on `f` = note: ...but it actually implements `FnOnce<(&'2 T,)>`, for some specific lifetime `'2` error: aborting due to 5 previous errors diff --git a/tests/ui/mismatched_types/closure-arg-type-mismatch.stderr b/tests/ui/mismatched_types/closure-arg-type-mismatch.stderr index 856aba98d1c4c..72945d962a570 100644 --- a/tests/ui/mismatched_types/closure-arg-type-mismatch.stderr +++ b/tests/ui/mismatched_types/closure-arg-type-mismatch.stderr @@ -66,29 +66,31 @@ LL | fn baz(_: F) {} error: implementation of `Fn` is not general enough --> $DIR/closure-arg-type-mismatch.rs:10:5 | -LL | fn baz(_: F) {} - | --- ------------- unsatisfied where-clause on `baz` - | | - | due to a where-clause on `baz`... -LL | fn _test<'a>(f: fn(*mut &'a u32)) { LL | baz(f); | ^^^^^^ | - = note: ...`fn(*mut &'2 u32)` must implement `Fn<(*mut &'1 u32,)>`, for any lifetime `'1`... +note: `fn(*mut &'2 u32)` must implement `Fn<(*mut &'1 u32,)>`, for any lifetime `'1`... + --> $DIR/closure-arg-type-mismatch.rs:8:11 + | +LL | fn baz(_: F) {} + | --- ^^^^^^^^^^^^^ unsatisfied where-clause on `baz` + | | + | due to a where-clause on `baz` = note: ...but it actually implements `Fn<(*mut &'2 u32,)>`, for some specific lifetime `'2` error: implementation of `FnOnce` is not general enough --> $DIR/closure-arg-type-mismatch.rs:10:5 | -LL | fn baz(_: F) {} - | --- ------------- unsatisfied where-clause on `baz` - | | - | due to a where-clause on `baz`... -LL | fn _test<'a>(f: fn(*mut &'a u32)) { LL | baz(f); | ^^^^^^ | - = note: ...`fn(*mut &'2 u32)` must implement `FnOnce<(*mut &'1 u32,)>`, for any lifetime `'1`... +note: `fn(*mut &'2 u32)` must implement `FnOnce<(*mut &'1 u32,)>`, for any lifetime `'1`... + --> $DIR/closure-arg-type-mismatch.rs:8:11 + | +LL | fn baz(_: F) {} + | --- ^^^^^^^^^^^^^ unsatisfied where-clause on `baz` + | | + | due to a where-clause on `baz` = note: ...but it actually implements `FnOnce<(*mut &'2 u32,)>`, for some specific lifetime `'2` error: aborting due to 6 previous errors diff --git a/tests/ui/mismatched_types/closure-mismatch.current.stderr b/tests/ui/mismatched_types/closure-mismatch.current.stderr index 0dbefa4b2aa19..0249537dcba54 100644 --- a/tests/ui/mismatched_types/closure-mismatch.current.stderr +++ b/tests/ui/mismatched_types/closure-mismatch.current.stderr @@ -1,15 +1,16 @@ error: implementation of `FnOnce` is not general enough --> $DIR/closure-mismatch.rs:12:5 | -LL | fn baz(_: T) {} - | --- --- unsatisfied where-clause on `baz` - | | - | due to a where-clause on `baz`... -... LL | baz(|_| ()); | ^^^^^^^^^^^ | - = note: ...closure with signature `fn(&'2 ())` must implement `FnOnce<(&'1 (),)>`, for any lifetime `'1`... +note: closure with signature `fn(&'2 ())` must implement `FnOnce<(&'1 (),)>`, for any lifetime `'1`... + --> $DIR/closure-mismatch.rs:9:11 + | +LL | fn baz(_: T) {} + | --- ^^^ unsatisfied where-clause on `baz` + | | + | due to a where-clause on `baz` = note: ...but it actually implements `FnOnce<(&'2 (),)>`, for some specific lifetime `'2` help: consider adding an explicit type annotation to the closure's argument | @@ -19,15 +20,16 @@ LL | baz(|_: &()| ()); error: implementation of `Fn` is not general enough --> $DIR/closure-mismatch.rs:12:5 | -LL | fn baz(_: T) {} - | --- --- unsatisfied where-clause on `baz` - | | - | due to a where-clause on `baz`... -... LL | baz(|_| ()); | ^^^^^^^^^^^ | - = note: ...closure with signature `fn(&'2 ())` must implement `Fn<(&'1 (),)>`, for any lifetime `'1`... +note: closure with signature `fn(&'2 ())` must implement `Fn<(&'1 (),)>`, for any lifetime `'1`... + --> $DIR/closure-mismatch.rs:9:11 + | +LL | fn baz(_: T) {} + | --- ^^^ unsatisfied where-clause on `baz` + | | + | due to a where-clause on `baz` = note: ...but it actually implements `Fn<(&'2 (),)>`, for some specific lifetime `'2` help: consider adding an explicit type annotation to the closure's argument | @@ -37,15 +39,16 @@ LL | baz(|_: &()| ()); error: implementation of `FnOnce` is not general enough --> $DIR/closure-mismatch.rs:16:5 | -LL | fn baz(_: T) {} - | --- --- unsatisfied where-clause on `baz` - | | - | due to a where-clause on `baz`... -... LL | baz(|x| ()); | ^^^^^^^^^^^ | - = note: ...closure with signature `fn(&'2 ())` must implement `FnOnce<(&'1 (),)>`, for any lifetime `'1`... +note: closure with signature `fn(&'2 ())` must implement `FnOnce<(&'1 (),)>`, for any lifetime `'1`... + --> $DIR/closure-mismatch.rs:9:11 + | +LL | fn baz(_: T) {} + | --- ^^^ unsatisfied where-clause on `baz` + | | + | due to a where-clause on `baz` = note: ...but it actually implements `FnOnce<(&'2 (),)>`, for some specific lifetime `'2` help: consider adding an explicit type annotation to the closure's argument | @@ -55,15 +58,16 @@ LL | baz(|x: &()| ()); error: implementation of `Fn` is not general enough --> $DIR/closure-mismatch.rs:16:5 | -LL | fn baz(_: T) {} - | --- --- unsatisfied where-clause on `baz` - | | - | due to a where-clause on `baz`... -... LL | baz(|x| ()); | ^^^^^^^^^^^ | - = note: ...closure with signature `fn(&'2 ())` must implement `Fn<(&'1 (),)>`, for any lifetime `'1`... +note: closure with signature `fn(&'2 ())` must implement `Fn<(&'1 (),)>`, for any lifetime `'1`... + --> $DIR/closure-mismatch.rs:9:11 + | +LL | fn baz(_: T) {} + | --- ^^^ unsatisfied where-clause on `baz` + | | + | due to a where-clause on `baz` = note: ...but it actually implements `Fn<(&'2 (),)>`, for some specific lifetime `'2` help: consider adding an explicit type annotation to the closure's argument | diff --git a/tests/ui/nll/ice-106874.stderr b/tests/ui/nll/ice-106874.stderr index 60f155eb45eb1..5e60b16903b82 100644 --- a/tests/ui/nll/ice-106874.stderr +++ b/tests/ui/nll/ice-106874.stderr @@ -3,13 +3,14 @@ error: implementation of `FnOnce` is not general enough | LL | A(B(C::new(D::new(move |st| f(st))))) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -... + | +note: closure with signature `fn(&'0 mut V)` must implement `FnOnce<(&mut V,)>`, for some specific lifetime `'0`... + --> $DIR/ice-106874.rs:28:10 + | LL | struct B(Rc); - | - - unsatisfied where-clause on `B` + | - ^ unsatisfied where-clause on `B` | | - | due to a where-clause on `B`... - | - = note: ...closure with signature `fn(&'0 mut V)` must implement `FnOnce<(&mut V,)>`, for some specific lifetime `'0`... + | due to a where-clause on `B` = note: ...but it actually implements `FnOnce<(&'1 mut V,)>`, for some specific lifetime `'1` help: consider adding an explicit type annotation to the closure's argument | @@ -21,13 +22,14 @@ error: implementation of `FnOnce` is not general enough | LL | A(B(C::new(D::new(move |st| f(st))))) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -... + | +note: closure with signature `fn(&'0 mut V)` must implement `FnOnce<(&mut V,)>`, for some specific lifetime `'0`... + --> $DIR/ice-106874.rs:28:10 + | LL | struct B(Rc); - | - - unsatisfied where-clause on `B` + | - ^ unsatisfied where-clause on `B` | | - | due to a where-clause on `B`... - | - = note: ...closure with signature `fn(&'0 mut V)` must implement `FnOnce<(&mut V,)>`, for some specific lifetime `'0`... + | due to a where-clause on `B` = note: ...but it actually implements `FnOnce<(&'1 mut V,)>`, for some specific lifetime `'1` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` help: consider adding an explicit type annotation to the closure's argument @@ -81,14 +83,13 @@ error: implementation of `FnOnce` is not general enough LL | A(B(C::new(D::new(move |st| f(st))))) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | +note: closure with signature `fn(&'2 mut V)` must implement `FnOnce<(&'1 mut V,)>`, for any lifetime `'1`... --> $SRC_DIR/alloc/src/rcs/rc.rs:LL:COL | - = note: due to a where-clause on `Rc`... + = note: due to a where-clause on `Rc` ::: $SRC_DIR/alloc/src/rcs/rc.rs:LL:COL | = note: unsatisfied where-clause on `Rc` - | - = note: ...closure with signature `fn(&'2 mut V)` must implement `FnOnce<(&'1 mut V,)>`, for any lifetime `'1`... = note: ...but it actually implements `FnOnce<(&'2 mut V,)>`, for some specific lifetime `'2` help: consider adding an explicit type annotation to the closure's argument | @@ -101,14 +102,13 @@ error: implementation of `Fn` is not general enough LL | A(B(C::new(D::new(move |st| f(st))))) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | +note: closure with signature `fn(&'2 mut V)` must implement `Fn<(&'1 mut V,)>`, for any lifetime `'1`... --> $SRC_DIR/alloc/src/rcs/rc.rs:LL:COL | - = note: due to a where-clause on `Rc`... + = note: due to a where-clause on `Rc` ::: $SRC_DIR/alloc/src/rcs/rc.rs:LL:COL | = note: unsatisfied where-clause on `Rc` - | - = note: ...closure with signature `fn(&'2 mut V)` must implement `Fn<(&'1 mut V,)>`, for any lifetime `'1`... = note: ...but it actually implements `Fn<(&'2 mut V,)>`, for some specific lifetime `'2` help: consider adding an explicit type annotation to the closure's argument | @@ -120,13 +120,14 @@ error: implementation of `FnOnce` is not general enough | LL | A(B(C::new(D::new(move |st| f(st))))) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -... + | +note: closure with signature `fn(&'2 mut V)` must implement `FnOnce<(&'1 mut V,)>`, for any lifetime `'1`... + --> $DIR/ice-106874.rs:28:10 + | LL | struct B(Rc); - | - - unsatisfied where-clause on `B` + | - ^ unsatisfied where-clause on `B` | | - | due to a where-clause on `B`... - | - = note: ...closure with signature `fn(&'2 mut V)` must implement `FnOnce<(&'1 mut V,)>`, for any lifetime `'1`... + | due to a where-clause on `B` = note: ...but it actually implements `FnOnce<(&'2 mut V,)>`, for some specific lifetime `'2` help: consider adding an explicit type annotation to the closure's argument | @@ -138,13 +139,14 @@ error: implementation of `Fn` is not general enough | LL | A(B(C::new(D::new(move |st| f(st))))) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -... + | +note: closure with signature `fn(&'2 mut V)` must implement `Fn<(&'1 mut V,)>`, for any lifetime `'1`... + --> $DIR/ice-106874.rs:28:10 + | LL | struct B(Rc); - | - - unsatisfied where-clause on `B` + | - ^ unsatisfied where-clause on `B` | | - | due to a where-clause on `B`... - | - = note: ...closure with signature `fn(&'2 mut V)` must implement `Fn<(&'1 mut V,)>`, for any lifetime `'1`... + | due to a where-clause on `B` = note: ...but it actually implements `Fn<(&'2 mut V,)>`, for some specific lifetime `'2` help: consider adding an explicit type annotation to the closure's argument | diff --git a/tests/ui/nll/issue-54302-cases.stderr b/tests/ui/nll/issue-54302-cases.stderr index 4c5535258f624..8d45fc4db9c69 100644 --- a/tests/ui/nll/issue-54302-cases.stderr +++ b/tests/ui/nll/issue-54302-cases.stderr @@ -1,49 +1,53 @@ error: implementation of `Foo` is not general enough --> $DIR/issue-54302-cases.rs:63:5 | -LL | fn ref_foo(&self) -> &'static T; - | ------- due to a where-clause on `RefFoo::ref_foo`... -... LL | >::ref_foo(a) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unsatisfied where-clause on `RefFoo::ref_foo` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: `Foo<'static, u32>` would have to be implemented for the type `&'0 u32`, for any lifetime `'0`... + --> $DIR/issue-54302-cases.rs:51:8 | - = note: ...`Foo<'static, u32>` would have to be implemented for the type `&'0 u32`, for any lifetime `'0`... +LL | fn ref_foo(&self) -> &'static T; + | ^^^^^^^ due to a where-clause on `RefFoo::ref_foo` = note: ...but `Foo<'_, u32>` is actually implemented for the type `&'1 u32`, for some specific lifetime `'1` error: implementation of `Foo` is not general enough --> $DIR/issue-54302-cases.rs:69:5 | -LL | fn ref_foo(&self) -> &'static T; - | ------- due to a where-clause on `RefFoo::ref_foo`... -... LL | >::ref_foo(a) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unsatisfied where-clause on `RefFoo::ref_foo` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: `Foo<'static, i32>` would have to be implemented for the type `&'0 i32`, for any lifetime `'0`... + --> $DIR/issue-54302-cases.rs:51:8 | - = note: ...`Foo<'static, i32>` would have to be implemented for the type `&'0 i32`, for any lifetime `'0`... +LL | fn ref_foo(&self) -> &'static T; + | ^^^^^^^ due to a where-clause on `RefFoo::ref_foo` = note: ...but `Foo<'_, i32>` is actually implemented for the type `&'1 i32`, for some specific lifetime `'1` error: implementation of `Foo` is not general enough --> $DIR/issue-54302-cases.rs:75:5 | -LL | fn ref_foo(&self) -> &'static T; - | ------- due to a where-clause on `RefFoo::ref_foo`... -... LL | >::ref_foo(a) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unsatisfied where-clause on `RefFoo::ref_foo` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: `Foo<'static, u64>` would have to be implemented for the type `&'0 u64`, for any lifetime `'0`... + --> $DIR/issue-54302-cases.rs:51:8 | - = note: ...`Foo<'static, u64>` would have to be implemented for the type `&'0 u64`, for any lifetime `'0`... +LL | fn ref_foo(&self) -> &'static T; + | ^^^^^^^ due to a where-clause on `RefFoo::ref_foo` = note: ...but `Foo<'_, u64>` is actually implemented for the type `&'1 u64`, for some specific lifetime `'1` error: implementation of `Foo` is not general enough --> $DIR/issue-54302-cases.rs:81:5 | -LL | fn ref_foo(&self) -> &'static T; - | ------- due to a where-clause on `RefFoo::ref_foo`... -... LL | >::ref_foo(a) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unsatisfied where-clause on `RefFoo::ref_foo` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: `Foo<'static, i64>` would have to be implemented for the type `&'0 i64`, for any lifetime `'0`... + --> $DIR/issue-54302-cases.rs:51:8 | - = note: ...`Foo<'static, i64>` would have to be implemented for the type `&'0 i64`, for any lifetime `'0`... +LL | fn ref_foo(&self) -> &'static T; + | ^^^^^^^ due to a where-clause on `RefFoo::ref_foo` = note: ...but `Foo<'_, i64>` is actually implemented for the type `&'1 i64`, for some specific lifetime `'1` error: aborting due to 4 previous errors diff --git a/tests/ui/nll/missing-universe-cause-issue-114907.stderr b/tests/ui/nll/missing-universe-cause-issue-114907.stderr index f0f407afd7601..74e240122aa70 100644 --- a/tests/ui/nll/missing-universe-cause-issue-114907.stderr +++ b/tests/ui/nll/missing-universe-cause-issue-114907.stderr @@ -1,15 +1,16 @@ error: implementation of `FnOnce` is not general enough --> $DIR/missing-universe-cause-issue-114907.rs:33:5 | -LL | fn accept(_: C) -> Handshake> { - | ------ ----------- unsatisfied where-clause on `accept` - | | - | due to a where-clause on `accept`... -... LL | accept(callback); | ^^^^^^^^^^^^^^^^ | - = note: ...closure with signature `fn(&'2 ())` must implement `FnOnce<(&'1 (),)>`, for any lifetime `'1`... +note: closure with signature `fn(&'2 ())` must implement `FnOnce<(&'1 (),)>`, for any lifetime `'1`... + --> $DIR/missing-universe-cause-issue-114907.rs:27:14 + | +LL | fn accept(_: C) -> Handshake> { + | ------ ^^^^^^^^^^^ unsatisfied where-clause on `accept` + | | + | due to a where-clause on `accept` = note: ...but it actually implements `FnOnce<(&'2 (),)>`, for some specific lifetime `'2` help: consider adding an explicit type annotation to the closure's argument | @@ -19,15 +20,16 @@ LL | let callback = |_: &()| {}; error: implementation of `FnOnce` is not general enough --> $DIR/missing-universe-cause-issue-114907.rs:33:5 | -LL | fn accept(_: C) -> Handshake> { - | ------ ----------- unsatisfied where-clause on `accept` - | | - | due to a where-clause on `accept`... -... LL | accept(callback); | ^^^^^^^^^^^^^^^^ | - = note: ...closure with signature `fn(&'2 ())` must implement `FnOnce<(&'1 (),)>`, for any lifetime `'1`... +note: closure with signature `fn(&'2 ())` must implement `FnOnce<(&'1 (),)>`, for any lifetime `'1`... + --> $DIR/missing-universe-cause-issue-114907.rs:27:14 + | +LL | fn accept(_: C) -> Handshake> { + | ------ ^^^^^^^^^^^ unsatisfied where-clause on `accept` + | | + | due to a where-clause on `accept` = note: ...but it actually implements `FnOnce<(&'2 (),)>`, for some specific lifetime `'2` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` help: consider adding an explicit type annotation to the closure's argument @@ -38,15 +40,16 @@ LL | let callback = |_: &()| {}; error: implementation of `FnOnce` is not general enough --> $DIR/missing-universe-cause-issue-114907.rs:33:5 | -LL | struct Handshake { - | --------- ---- unsatisfied where-clause on `Handshake` - | | - | due to a where-clause on `Handshake`... -... LL | accept(callback); | ^^^^^^^^^^^^^^^^ | - = note: ...closure with signature `fn(&'2 ())` must implement `FnOnce<(&'1 (),)>`, for any lifetime `'1`... +note: closure with signature `fn(&'2 ())` must implement `FnOnce<(&'1 (),)>`, for any lifetime `'1`... + --> $DIR/missing-universe-cause-issue-114907.rs:20:21 + | +LL | struct Handshake { + | --------- ^^^^ unsatisfied where-clause on `Handshake` + | | + | due to a where-clause on `Handshake` = note: ...but it actually implements `FnOnce<(&'2 (),)>`, for some specific lifetime `'2` help: consider adding an explicit type annotation to the closure's argument | @@ -56,15 +59,16 @@ LL | let callback = |_: &()| {}; error: implementation of `FnOnce` is not general enough --> $DIR/missing-universe-cause-issue-114907.rs:33:5 | -LL | struct Handshake { - | --------- ---- unsatisfied where-clause on `Handshake` - | | - | due to a where-clause on `Handshake`... -... LL | accept(callback); | ^^^^^^^^^^^^^^^^ | - = note: ...closure with signature `fn(&'2 ())` must implement `FnOnce<(&'1 (),)>`, for any lifetime `'1`... +note: closure with signature `fn(&'2 ())` must implement `FnOnce<(&'1 (),)>`, for any lifetime `'1`... + --> $DIR/missing-universe-cause-issue-114907.rs:20:21 + | +LL | struct Handshake { + | --------- ^^^^ unsatisfied where-clause on `Handshake` + | | + | due to a where-clause on `Handshake` = note: ...but it actually implements `FnOnce<(&'2 (),)>`, for some specific lifetime `'2` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` help: consider adding an explicit type annotation to the closure's argument diff --git a/tests/ui/nll/polonius/location-insensitive-scopes-issue-117146.nll.stderr b/tests/ui/nll/polonius/location-insensitive-scopes-issue-117146.nll.stderr index 2e164c9b3abb7..4538c51a2bb52 100644 --- a/tests/ui/nll/polonius/location-insensitive-scopes-issue-117146.nll.stderr +++ b/tests/ui/nll/polonius/location-insensitive-scopes-issue-117146.nll.stderr @@ -29,13 +29,14 @@ error: implementation of `Fn` is not general enough | LL | bad(&b); | ^^^^^^^ -... + | +note: closure with signature `fn(&'2 ()) -> &()` must implement `Fn<(&'1 (),)>`, for any lifetime `'1`... + --> $DIR/location-insensitive-scopes-issue-117146.rs:21:11 + | LL | fn bad &()>(_: F) {} - | --- -------------- unsatisfied where-clause on `bad` + | --- ^^^^^^^^^^^^^^ unsatisfied where-clause on `bad` | | - | due to a where-clause on `bad`... - | - = note: ...closure with signature `fn(&'2 ()) -> &()` must implement `Fn<(&'1 (),)>`, for any lifetime `'1`... + | due to a where-clause on `bad` = note: ...but it actually implements `Fn<(&'2 (),)>`, for some specific lifetime `'2` help: consider adding an explicit type annotation to the closure's argument | @@ -47,13 +48,14 @@ error: implementation of `FnOnce` is not general enough | LL | bad(&b); | ^^^^^^^ -... + | +note: closure with signature `fn(&'2 ()) -> &()` must implement `FnOnce<(&'1 (),)>`, for any lifetime `'1`... + --> $DIR/location-insensitive-scopes-issue-117146.rs:21:22 + | LL | fn bad &()>(_: F) {} - | --- --- unsatisfied where-clause on `bad` + | --- ^^^ unsatisfied where-clause on `bad` | | - | due to a where-clause on `bad`... - | - = note: ...closure with signature `fn(&'2 ()) -> &()` must implement `FnOnce<(&'1 (),)>`, for any lifetime `'1`... + | due to a where-clause on `bad` = note: ...but it actually implements `FnOnce<(&'2 (),)>`, for some specific lifetime `'2` help: consider adding an explicit type annotation to the closure's argument | diff --git a/tests/ui/nll/polonius/location-insensitive-scopes-issue-117146.polonius.stderr b/tests/ui/nll/polonius/location-insensitive-scopes-issue-117146.polonius.stderr index 2e164c9b3abb7..4538c51a2bb52 100644 --- a/tests/ui/nll/polonius/location-insensitive-scopes-issue-117146.polonius.stderr +++ b/tests/ui/nll/polonius/location-insensitive-scopes-issue-117146.polonius.stderr @@ -29,13 +29,14 @@ error: implementation of `Fn` is not general enough | LL | bad(&b); | ^^^^^^^ -... + | +note: closure with signature `fn(&'2 ()) -> &()` must implement `Fn<(&'1 (),)>`, for any lifetime `'1`... + --> $DIR/location-insensitive-scopes-issue-117146.rs:21:11 + | LL | fn bad &()>(_: F) {} - | --- -------------- unsatisfied where-clause on `bad` + | --- ^^^^^^^^^^^^^^ unsatisfied where-clause on `bad` | | - | due to a where-clause on `bad`... - | - = note: ...closure with signature `fn(&'2 ()) -> &()` must implement `Fn<(&'1 (),)>`, for any lifetime `'1`... + | due to a where-clause on `bad` = note: ...but it actually implements `Fn<(&'2 (),)>`, for some specific lifetime `'2` help: consider adding an explicit type annotation to the closure's argument | @@ -47,13 +48,14 @@ error: implementation of `FnOnce` is not general enough | LL | bad(&b); | ^^^^^^^ -... + | +note: closure with signature `fn(&'2 ()) -> &()` must implement `FnOnce<(&'1 (),)>`, for any lifetime `'1`... + --> $DIR/location-insensitive-scopes-issue-117146.rs:21:22 + | LL | fn bad &()>(_: F) {} - | --- --- unsatisfied where-clause on `bad` + | --- ^^^ unsatisfied where-clause on `bad` | | - | due to a where-clause on `bad`... - | - = note: ...closure with signature `fn(&'2 ()) -> &()` must implement `FnOnce<(&'1 (),)>`, for any lifetime `'1`... + | due to a where-clause on `bad` = note: ...but it actually implements `FnOnce<(&'2 (),)>`, for some specific lifetime `'2` help: consider adding an explicit type annotation to the closure's argument | diff --git a/tests/ui/nll/relate_tys/impl-fn-ignore-binder-via-bottom.stderr b/tests/ui/nll/relate_tys/impl-fn-ignore-binder-via-bottom.stderr index ced5c4b8058b0..e03e0cd465158 100644 --- a/tests/ui/nll/relate_tys/impl-fn-ignore-binder-via-bottom.stderr +++ b/tests/ui/nll/relate_tys/impl-fn-ignore-binder-via-bottom.stderr @@ -1,25 +1,27 @@ error: implementation of `Y` is not general enough --> $DIR/impl-fn-ignore-binder-via-bottom.rs:30:14 | -LL | fn make_f() -> Self::F; - | ------ due to a where-clause on `Y::make_f`... -... LL | let _x = ::make_f(); - | ^^^^^^^^^^^^^^^^^^^ unsatisfied where-clause on `Y::make_f` + | ^^^^^^^^^^^^^^^^^^^ + | +note: `Y` would have to be implemented for the type `for<'a> fn(&'a ())` + --> $DIR/impl-fn-ignore-binder-via-bottom.rs:18:8 | - = note: ...`Y` would have to be implemented for the type `for<'a> fn(&'a ())` +LL | fn make_f() -> Self::F; + | ^^^^^^ due to a where-clause on `Y::make_f` = note: ...but `Y` is actually implemented for the type `fn(&'0 ())`, for some specific lifetime `'0` error: implementation of `Y` is not general enough --> $DIR/impl-fn-ignore-binder-via-bottom.rs:30:14 | -LL | trait Y { - | - due to a where-clause on `Y`... -... LL | let _x = ::make_f(); - | ^^^^^^^^^^^^^^^^^^^ unsatisfied where-clause on `Y` + | ^^^^^^^^^^^^^^^^^^^ + | +note: `Y` would have to be implemented for the type `for<'a> fn(&'a ())` + --> $DIR/impl-fn-ignore-binder-via-bottom.rs:16:7 | - = note: ...`Y` would have to be implemented for the type `for<'a> fn(&'a ())` +LL | trait Y { + | ^ due to a where-clause on `Y` = note: ...but `Y` is actually implemented for the type `fn(&'0 ())`, for some specific lifetime `'0` error: implementation of `Y` is not general enough diff --git a/tests/ui/unboxed-closures/issue-30906.stderr b/tests/ui/unboxed-closures/issue-30906.stderr index fa61b3af02cf0..5d5d712c6e3e4 100644 --- a/tests/ui/unboxed-closures/issue-30906.stderr +++ b/tests/ui/unboxed-closures/issue-30906.stderr @@ -1,15 +1,16 @@ error: implementation of `FnOnce` is not general enough --> $DIR/issue-30906.rs:18:5 | -LL | fn test FnOnce<(&'x str,)>>(_: F) {} - | ---- -------------------------- unsatisfied where-clause on `test` - | | - | due to a where-clause on `test`... -... LL | test(Compose(f, |_| {})); | ^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: ...`fn(&'2 str) -> T` must implement `FnOnce<(&'1 str,)>`, for any lifetime `'1`... +note: `fn(&'2 str) -> T` must implement `FnOnce<(&'1 str,)>`, for any lifetime `'1`... + --> $DIR/issue-30906.rs:3:12 + | +LL | fn test FnOnce<(&'x str,)>>(_: F) {} + | ---- ^^^^^^^^^^^^^^^^^^^^^^^^^^ unsatisfied where-clause on `test` + | | + | due to a where-clause on `test` = note: ...but it actually implements `FnOnce<(&'2 str,)>`, for some specific lifetime `'2` error: aborting due to 1 previous error diff --git a/tests/ui/where-clauses/where-for-self-2.stderr b/tests/ui/where-clauses/where-for-self-2.stderr index 378616d9aca57..7c7af181f601b 100644 --- a/tests/ui/where-clauses/where-for-self-2.stderr +++ b/tests/ui/where-clauses/where-for-self-2.stderr @@ -1,16 +1,17 @@ error: implementation of `Bar` is not general enough --> $DIR/where-for-self-2.rs:23:5 | -LL | fn foo(x: &T) - | --- due to a where-clause on `foo`... -LL | where -LL | for<'a> &'a T: Bar, - | --- unsatisfied where-clause on `foo` -... LL | foo(&X); | ^^^^^^^ | - = note: ...`&'0 u32` must implement `Bar`, for any lifetime `'0`... +note: `&'0 u32` must implement `Bar`, for any lifetime `'0`... + --> $DIR/where-for-self-2.rs:18:20 + | +LL | fn foo(x: &T) + | --- due to a where-clause on `foo` +LL | where +LL | for<'a> &'a T: Bar, + | ^^^ unsatisfied where-clause on `foo` = note: ...but `Bar` is actually implemented for the type `&'static u32` error: aborting due to 1 previous error From cf56d126fd0befc4fbccb2cba8eaac1d06a2bb83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Wed, 30 Sep 2026 23:09:47 +0000 Subject: [PATCH 3/5] Tweak wording --- .../rustc_trait_selection/src/diagnostics.rs | 6 ++--- .../nice_region_error/placeholder_error.rs | 8 +++++-- .../associated-types-eq-hr.stderr | 24 +++++++------------ ...outine-auto-trait-span-issue-155880.stderr | 4 +--- ...olved-typeck-results.no_assumptions.stderr | 8 ++----- ...ranked-auto-trait-12.no_assumptions.stderr | 4 +--- ...er-ranked-auto-trait-13.assumptions.stderr | 16 ++++--------- ...ranked-auto-trait-13.no_assumptions.stderr | 24 +++++-------------- ...ranked-auto-trait-15.no_assumptions.stderr | 8 ++----- ...er-ranked-auto-trait-16.assumptions.stderr | 8 ++----- ...ranked-auto-trait-16.no_assumptions.stderr | 8 ++----- ...-ranked-auto-trait-5.no_assumptions.stderr | 3 +-- .../issue-110963-early.no_assumptions.stderr | 6 ++--- ...ation-not-general-enough-ice-133252.stderr | 4 +--- ...n-with-leaking-placeholders.current.stderr | 3 +-- ...rtb-closure-suggest-type-annotation.stderr | 6 ++--- tests/ui/coroutine/auto-trait-regions.stderr | 8 ++----- .../ui/coroutine/resume-arg-late-bound.stderr | 4 +--- ...ot-checked-with-right-substitutions.stderr | 4 +--- ...hr-fn-ptr-trait-impl-mismatch-29061.stderr | 12 +++------- ...tb-associated-type-leak-check-55731.stderr | 3 +-- ...n-ptr-impl-not-general-enough-57936.stderr | 4 +--- .../trait-bounds/hrtb-conflate-regions.stderr | 6 ++--- ...b-exists-forall-trait-contravariant.stderr | 3 +-- .../hrtb-exists-forall-trait-covariant.stderr | 3 +-- .../hrtb-exists-forall-trait-invariant.stderr | 3 +-- .../trait-bounds/hrtb-just-for-static.stderr | 3 +-- .../hrtb-perfect-forwarding.stderr | 3 +-- .../trait-bounds/issue-46989.stderr | 4 +--- .../trait-bounds/issue-59311.stderr | 6 ++--- .../issue-71955.current.stderr | 12 ++++------ tests/ui/lifetimes/issue-105675.stderr | 24 +++++-------------- tests/ui/lifetimes/issue-79187-2.stderr | 8 ++----- tests/ui/lifetimes/issue-79187.stderr | 8 ++----- .../lifetime-errors/issue_74400.stderr | 6 ++--- .../closure-arg-type-mismatch.stderr | 8 ++----- .../closure-mismatch.current.stderr | 16 ++++--------- tests/ui/nll/ice-106874.stderr | 24 +++++-------------- tests/ui/nll/issue-54302-cases.stderr | 8 +++---- ...missing-universe-cause-issue-114907.stderr | 16 ++++--------- ...insensitive-scopes-issue-117146.nll.stderr | 8 ++----- ...sitive-scopes-issue-117146.polonius.stderr | 8 ++----- .../impl-fn-ignore-binder-via-bottom.stderr | 4 ++-- tests/ui/unboxed-closures/issue-30906.stderr | 4 +--- .../ui/where-clauses/where-for-self-2.stderr | 3 +-- 45 files changed, 107 insertions(+), 256 deletions(-) diff --git a/compiler/rustc_trait_selection/src/diagnostics.rs b/compiler/rustc_trait_selection/src/diagnostics.rs index 9d2238c188157..72b57c6af99d5 100644 --- a/compiler/rustc_trait_selection/src/diagnostics.rs +++ b/compiler/rustc_trait_selection/src/diagnostics.rs @@ -1096,17 +1096,17 @@ impl<'tcx> ActualImplExplNotes<'tcx> { item_span: Option, item_name: String, ) -> Self { - let label = format!("unsatisfied where-clause on `{item_name}`"); - let item_label = format!("due to a where-clause on `{item_name}`"); + let label = format!("required by this bound in `{item_name}`"); let span = match (satisfy_span, item_span) { (Some(satisfy_span), Some(item_span)) => { let mut span = MultiSpan::from(satisfy_span); span.push_span_label(satisfy_span, label); - span.push_span_label(item_span, item_label); + span.push_span_context(item_span); span } (None, Some(item_span)) => { let mut span = MultiSpan::from(item_span); + let item_label = format!("required due to a bound in `{item_name}`"); span.push_span_label(item_span, item_label); span } diff --git a/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/placeholder_error.rs b/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/placeholder_error.rs index 1b57e3d77d503..9cf38a23bf295 100644 --- a/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/placeholder_error.rs +++ b/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/placeholder_error.rs @@ -297,10 +297,14 @@ impl<'tcx> NiceRegionError<'_, 'tcx> { } else { (None, None, Some(span), String::new()) }; - if let Some(span) = satisfy_span && span.is_dummy() { + if let Some(span) = satisfy_span + && span.is_dummy() + { satisfy_span = None; } - if let Some(span) = item_span && span.is_dummy() { + if let Some(span) = item_span + && span.is_dummy() + { item_span = None; } diff --git a/tests/ui/associated-types/associated-types-eq-hr.stderr b/tests/ui/associated-types/associated-types-eq-hr.stderr index 19fd633334f00..4f85111897df5 100644 --- a/tests/ui/associated-types/associated-types-eq-hr.stderr +++ b/tests/ui/associated-types/associated-types-eq-hr.stderr @@ -50,10 +50,9 @@ note: `Tuple` must implement `TheTrait<(&'0 isize, &'1 isize)>`, for any two lif --> $DIR/associated-types-eq-hr.rs:59:8 | LL | fn tuple_one() - | --------- due to a where-clause on `tuple_one` LL | where LL | T: for<'x, 'y> TheTrait<(&'x isize, &'y isize), A = &'x isize>, - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unsatisfied where-clause on `tuple_one` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `tuple_one` note: ...but it actually implements `TheTrait<(&'2 isize, &'2 isize)>`, for some specific lifetime `'2` --> $DIR/associated-types-eq-hr.rs:35:1 | @@ -70,10 +69,9 @@ note: `Tuple` must implement `TheTrait<(&'0 isize, &'1 isize)>`, for any two lif --> $DIR/associated-types-eq-hr.rs:59:8 | LL | fn tuple_one() - | --------- due to a where-clause on `tuple_one` LL | where LL | T: for<'x, 'y> TheTrait<(&'x isize, &'y isize), A = &'x isize>, - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unsatisfied where-clause on `tuple_one` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `tuple_one` note: ...but it actually implements `TheTrait<(&'2 isize, &'2 isize)>`, for some specific lifetime `'2` --> $DIR/associated-types-eq-hr.rs:35:1 | @@ -91,10 +89,9 @@ note: `Tuple` must implement `TheTrait<(&'0 isize, &'1 isize)>`, for any two lif --> $DIR/associated-types-eq-hr.rs:59:53 | LL | fn tuple_one() - | --------- due to a where-clause on `tuple_one` LL | where LL | T: for<'x, 'y> TheTrait<(&'x isize, &'y isize), A = &'x isize>, - | ^^^^^^^^^^^^^ unsatisfied where-clause on `tuple_one` + | ^^^^^^^^^^^^^ required by this bound in `tuple_one` note: ...but it actually implements `TheTrait<(&'2 isize, &'2 isize)>`, for some specific lifetime `'2` --> $DIR/associated-types-eq-hr.rs:35:1 | @@ -111,10 +108,9 @@ note: `Tuple` must implement `TheTrait<(&'0 isize, &'1 isize)>`, for any two lif --> $DIR/associated-types-eq-hr.rs:59:53 | LL | fn tuple_one() - | --------- due to a where-clause on `tuple_one` LL | where LL | T: for<'x, 'y> TheTrait<(&'x isize, &'y isize), A = &'x isize>, - | ^^^^^^^^^^^^^ unsatisfied where-clause on `tuple_one` + | ^^^^^^^^^^^^^ required by this bound in `tuple_one` note: ...but it actually implements `TheTrait<(&'2 isize, &'2 isize)>`, for some specific lifetime `'2` --> $DIR/associated-types-eq-hr.rs:35:1 | @@ -132,10 +128,9 @@ note: `Tuple` must implement `TheTrait<(&'0 isize, &'1 isize)>`, for any two lif --> $DIR/associated-types-eq-hr.rs:66:8 | LL | fn tuple_two() - | --------- due to a where-clause on `tuple_two` LL | where LL | T: for<'x, 'y> TheTrait<(&'x isize, &'y isize), A = &'y isize>, - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unsatisfied where-clause on `tuple_two` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `tuple_two` note: ...but it actually implements `TheTrait<(&'2 isize, &'2 isize)>`, for some specific lifetime `'2` --> $DIR/associated-types-eq-hr.rs:35:1 | @@ -152,10 +147,9 @@ note: `Tuple` must implement `TheTrait<(&'0 isize, &'1 isize)>`, for any two lif --> $DIR/associated-types-eq-hr.rs:66:8 | LL | fn tuple_two() - | --------- due to a where-clause on `tuple_two` LL | where LL | T: for<'x, 'y> TheTrait<(&'x isize, &'y isize), A = &'y isize>, - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unsatisfied where-clause on `tuple_two` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `tuple_two` note: ...but it actually implements `TheTrait<(&'2 isize, &'2 isize)>`, for some specific lifetime `'2` --> $DIR/associated-types-eq-hr.rs:35:1 | @@ -202,10 +196,9 @@ note: `Tuple` must implement `TheTrait<(&'0 isize, &'1 isize)>`, for any two lif --> $DIR/associated-types-eq-hr.rs:80:8 | LL | fn tuple_four() - | ---------- due to a where-clause on `tuple_four` LL | where LL | T: for<'x, 'y> TheTrait<(&'x isize, &'y isize)>, - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unsatisfied where-clause on `tuple_four` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `tuple_four` note: ...but it actually implements `TheTrait<(&'2 isize, &'2 isize)>`, for some specific lifetime `'2` --> $DIR/associated-types-eq-hr.rs:35:1 | @@ -222,10 +215,9 @@ note: `Tuple` must implement `TheTrait<(&'0 isize, &'1 isize)>`, for any two lif --> $DIR/associated-types-eq-hr.rs:80:8 | LL | fn tuple_four() - | ---------- due to a where-clause on `tuple_four` LL | where LL | T: for<'x, 'y> TheTrait<(&'x isize, &'y isize)>, - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unsatisfied where-clause on `tuple_four` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `tuple_four` note: ...but it actually implements `TheTrait<(&'2 isize, &'2 isize)>`, for some specific lifetime `'2` --> $DIR/associated-types-eq-hr.rs:35:1 | diff --git a/tests/ui/async-await/coroutine-auto-trait-span-issue-155880.stderr b/tests/ui/async-await/coroutine-auto-trait-span-issue-155880.stderr index 893124920ee18..3bdb318678d92 100644 --- a/tests/ui/async-await/coroutine-auto-trait-span-issue-155880.stderr +++ b/tests/ui/async-await/coroutine-auto-trait-span-issue-155880.stderr @@ -14,9 +14,7 @@ note: `Send` would have to be implemented for the type `&'0 u32`, for any lifeti --> $DIR/coroutine-auto-trait-span-issue-155880.rs:25:15 | LL | fn is_send(_: T) {} - | ------- ^^^^ unsatisfied where-clause on `is_send` - | | - | due to a where-clause on `is_send` + | ^^^^ required by this bound in `is_send` = note: ...but `Send` is actually implemented for the type `&'1 u32`, for some specific lifetime `'1` error: aborting due to 1 previous error diff --git a/tests/ui/async-await/drop-tracking-unresolved-typeck-results.no_assumptions.stderr b/tests/ui/async-await/drop-tracking-unresolved-typeck-results.no_assumptions.stderr index da93d5a17547a..a5f148ae0ca76 100644 --- a/tests/ui/async-await/drop-tracking-unresolved-typeck-results.no_assumptions.stderr +++ b/tests/ui/async-await/drop-tracking-unresolved-typeck-results.no_assumptions.stderr @@ -10,9 +10,7 @@ note: `fn(&'0 ()) -> Ready<&'0 ()> {std::future::ready::<&'0 ()>}` must implemen --> $DIR/drop-tracking-unresolved-typeck-results.rs:13:12 | LL | fn send(_: T) {} - | ---- ^^^^ unsatisfied where-clause on `send` - | | - | due to a where-clause on `send` + | ^^^^ required by this bound in `send` = note: ...but it actually implements `FnOnce<(&(),)>` error: implementation of `FnOnce` is not general enough @@ -27,9 +25,7 @@ note: `fn(&'0 ()) -> Ready<&'0 ()> {std::future::ready::<&'0 ()>}` must implemen --> $DIR/drop-tracking-unresolved-typeck-results.rs:13:12 | LL | fn send(_: T) {} - | ---- ^^^^ unsatisfied where-clause on `send` - | | - | due to a where-clause on `send` + | ^^^^ required by this bound in `send` = note: ...but it actually implements `FnOnce<(&(),)>` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` diff --git a/tests/ui/async-await/higher-ranked-auto-trait-12.no_assumptions.stderr b/tests/ui/async-await/higher-ranked-auto-trait-12.no_assumptions.stderr index 39132cc9b4fb9..a55e42b4b6dfb 100644 --- a/tests/ui/async-await/higher-ranked-auto-trait-12.no_assumptions.stderr +++ b/tests/ui/async-await/higher-ranked-auto-trait-12.no_assumptions.stderr @@ -15,9 +15,7 @@ note: `Box<(dyn Robot + Send + '0)>` must implement `Robot`, for any l --> $DIR/higher-ranked-auto-trait-12.rs:24:20 | LL | fn this_is_send(value: T) -> T { - | ------------ ^^^^ unsatisfied where-clause on `this_is_send` - | | - | due to a where-clause on `this_is_send` + | ^^^^ required by this bound in `this_is_send` = note: ...but `Robot` is actually implemented for the type `Box<(dyn Robot + Send + 'static)>` error: aborting due to 1 previous error diff --git a/tests/ui/async-await/higher-ranked-auto-trait-13.assumptions.stderr b/tests/ui/async-await/higher-ranked-auto-trait-13.assumptions.stderr index 386a83ebbc761..63eef87aa2517 100644 --- a/tests/ui/async-await/higher-ranked-auto-trait-13.assumptions.stderr +++ b/tests/ui/async-await/higher-ranked-auto-trait-13.assumptions.stderr @@ -8,9 +8,7 @@ note: `Getter<'1>` would have to be implemented for the type `GetterImpl<'0, Con --> $DIR/higher-ranked-auto-trait-13.rs:52:24 | LL | fn assert_send(_: impl Send + Sync) {} - | ----------- ^^^^ unsatisfied where-clause on `assert_send` - | | - | due to a where-clause on `assert_send` + | ^^^^ required by this bound in `assert_send` = note: ...but `Getter<'2>` is actually implemented for the type `GetterImpl<'2, ConstructableImpl<'_>>`, for some specific lifetime `'2` error: implementation of `Getter` is not general enough @@ -23,9 +21,7 @@ note: `Getter<'1>` would have to be implemented for the type `GetterImpl<'0, Con --> $DIR/higher-ranked-auto-trait-13.rs:52:24 | LL | fn assert_send(_: impl Send + Sync) {} - | ----------- ^^^^ unsatisfied where-clause on `assert_send` - | | - | due to a where-clause on `assert_send` + | ^^^^ required by this bound in `assert_send` = note: ...but `Getter<'2>` is actually implemented for the type `GetterImpl<'2, ConstructableImpl<'_>>`, for some specific lifetime `'2` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` @@ -39,9 +35,7 @@ note: `Getter<'1>` would have to be implemented for the type `GetterImpl<'0, Con --> $DIR/higher-ranked-auto-trait-13.rs:52:31 | LL | fn assert_send(_: impl Send + Sync) {} - | ----------- ^^^^ unsatisfied where-clause on `assert_send` - | | - | due to a where-clause on `assert_send` + | ^^^^ required by this bound in `assert_send` = note: ...but `Getter<'2>` is actually implemented for the type `GetterImpl<'2, ConstructableImpl<'_>>`, for some specific lifetime `'2` error: implementation of `Getter` is not general enough @@ -54,9 +48,7 @@ note: `Getter<'1>` would have to be implemented for the type `GetterImpl<'0, Con --> $DIR/higher-ranked-auto-trait-13.rs:52:31 | LL | fn assert_send(_: impl Send + Sync) {} - | ----------- ^^^^ unsatisfied where-clause on `assert_send` - | | - | due to a where-clause on `assert_send` + | ^^^^ required by this bound in `assert_send` = note: ...but `Getter<'2>` is actually implemented for the type `GetterImpl<'2, ConstructableImpl<'_>>`, for some specific lifetime `'2` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` diff --git a/tests/ui/async-await/higher-ranked-auto-trait-13.no_assumptions.stderr b/tests/ui/async-await/higher-ranked-auto-trait-13.no_assumptions.stderr index 02f91c47fffcb..9d89d73270f71 100644 --- a/tests/ui/async-await/higher-ranked-auto-trait-13.no_assumptions.stderr +++ b/tests/ui/async-await/higher-ranked-auto-trait-13.no_assumptions.stderr @@ -8,9 +8,7 @@ note: `Getter<'1>` would have to be implemented for the type `GetterImpl<'0, Con --> $DIR/higher-ranked-auto-trait-13.rs:52:24 | LL | fn assert_send(_: impl Send + Sync) {} - | ----------- ^^^^ unsatisfied where-clause on `assert_send` - | | - | due to a where-clause on `assert_send` + | ^^^^ required by this bound in `assert_send` = note: ...but `Getter<'2>` is actually implemented for the type `GetterImpl<'2, ConstructableImpl<'_>>`, for some specific lifetime `'2` error: implementation of `Getter` is not general enough @@ -23,9 +21,7 @@ note: `Getter<'1>` would have to be implemented for the type `GetterImpl<'0, Con --> $DIR/higher-ranked-auto-trait-13.rs:52:24 | LL | fn assert_send(_: impl Send + Sync) {} - | ----------- ^^^^ unsatisfied where-clause on `assert_send` - | | - | due to a where-clause on `assert_send` + | ^^^^ required by this bound in `assert_send` = note: ...but `Getter<'2>` is actually implemented for the type `GetterImpl<'2, ConstructableImpl<'_>>`, for some specific lifetime `'2` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` @@ -39,9 +35,7 @@ note: `Callable<'_>` would have to be implemented for the type `ConstructableImp --> $DIR/higher-ranked-auto-trait-13.rs:52:24 | LL | fn assert_send(_: impl Send + Sync) {} - | ----------- ^^^^ unsatisfied where-clause on `assert_send` - | | - | due to a where-clause on `assert_send` + | ^^^^ required by this bound in `assert_send` = note: ...but `Callable<'1>` is actually implemented for the type `ConstructableImpl<'1>`, for some specific lifetime `'1` error: implementation of `Getter` is not general enough @@ -54,9 +48,7 @@ note: `Getter<'1>` would have to be implemented for the type `GetterImpl<'0, Con --> $DIR/higher-ranked-auto-trait-13.rs:52:31 | LL | fn assert_send(_: impl Send + Sync) {} - | ----------- ^^^^ unsatisfied where-clause on `assert_send` - | | - | due to a where-clause on `assert_send` + | ^^^^ required by this bound in `assert_send` = note: ...but `Getter<'2>` is actually implemented for the type `GetterImpl<'2, ConstructableImpl<'_>>`, for some specific lifetime `'2` error: implementation of `Getter` is not general enough @@ -69,9 +61,7 @@ note: `Getter<'1>` would have to be implemented for the type `GetterImpl<'0, Con --> $DIR/higher-ranked-auto-trait-13.rs:52:31 | LL | fn assert_send(_: impl Send + Sync) {} - | ----------- ^^^^ unsatisfied where-clause on `assert_send` - | | - | due to a where-clause on `assert_send` + | ^^^^ required by this bound in `assert_send` = note: ...but `Getter<'2>` is actually implemented for the type `GetterImpl<'2, ConstructableImpl<'_>>`, for some specific lifetime `'2` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` @@ -85,9 +75,7 @@ note: `Callable<'_>` would have to be implemented for the type `ConstructableImp --> $DIR/higher-ranked-auto-trait-13.rs:52:31 | LL | fn assert_send(_: impl Send + Sync) {} - | ----------- ^^^^ unsatisfied where-clause on `assert_send` - | | - | due to a where-clause on `assert_send` + | ^^^^ required by this bound in `assert_send` = note: ...but `Callable<'1>` is actually implemented for the type `ConstructableImpl<'1>`, for some specific lifetime `'1` error: aborting due to 6 previous errors diff --git a/tests/ui/async-await/higher-ranked-auto-trait-15.no_assumptions.stderr b/tests/ui/async-await/higher-ranked-auto-trait-15.no_assumptions.stderr index c6c8479474c64..94a187f69c91f 100644 --- a/tests/ui/async-await/higher-ranked-auto-trait-15.no_assumptions.stderr +++ b/tests/ui/async-await/higher-ranked-auto-trait-15.no_assumptions.stderr @@ -8,9 +8,7 @@ note: closure with signature `fn(&'0 _) -> Iter<'_, i32>` must implement `FnOnce --> $DIR/higher-ranked-auto-trait-15.rs:16:20 | LL | fn require_send(_x: T) {} - | ------------ ^^^^ unsatisfied where-clause on `require_send` - | | - | due to a where-clause on `require_send` + | ^^^^ required by this bound in `require_send` = note: ...but it actually implements `FnOnce<(&Vec,)>` help: consider adding an explicit type annotation to the closure's argument | @@ -27,9 +25,7 @@ note: closure with signature `fn(&'0 _) -> Iter<'_, i32>` must implement `FnOnce --> $DIR/higher-ranked-auto-trait-15.rs:16:20 | LL | fn require_send(_x: T) {} - | ------------ ^^^^ unsatisfied where-clause on `require_send` - | | - | due to a where-clause on `require_send` + | ^^^^ required by this bound in `require_send` = note: ...but it actually implements `FnOnce<(&Vec,)>` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` help: consider adding an explicit type annotation to the closure's argument diff --git a/tests/ui/async-await/higher-ranked-auto-trait-16.assumptions.stderr b/tests/ui/async-await/higher-ranked-auto-trait-16.assumptions.stderr index 52c54f8355c39..ff7a3230aa6c9 100644 --- a/tests/ui/async-await/higher-ranked-auto-trait-16.assumptions.stderr +++ b/tests/ui/async-await/higher-ranked-auto-trait-16.assumptions.stderr @@ -10,9 +10,7 @@ note: `{async closure@...}` must implement `AsyncFnOnce<(&mut Ctxt<'1>,)>`, for --> $DIR/higher-ranked-auto-trait-16.rs:8:19 | LL | fn assert_send(_: T) {} - | ----------- ^^^^ unsatisfied where-clause on `assert_send` - | | - | due to a where-clause on `assert_send` + | ^^^^ required by this bound in `assert_send` = note: ...but it actually implements `AsyncFnOnce<(&mut Ctxt<'_>,)>` error: implementation of `AsyncFnOnce` is not general enough @@ -27,9 +25,7 @@ note: `{async closure@...}` must implement `AsyncFnOnce<(&mut Ctxt<'1>,)>`, for --> $DIR/higher-ranked-auto-trait-16.rs:8:19 | LL | fn assert_send(_: T) {} - | ----------- ^^^^ unsatisfied where-clause on `assert_send` - | | - | due to a where-clause on `assert_send` + | ^^^^ required by this bound in `assert_send` = note: ...but it actually implements `AsyncFnOnce<(&mut Ctxt<'_>,)>` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` diff --git a/tests/ui/async-await/higher-ranked-auto-trait-16.no_assumptions.stderr b/tests/ui/async-await/higher-ranked-auto-trait-16.no_assumptions.stderr index 52c54f8355c39..ff7a3230aa6c9 100644 --- a/tests/ui/async-await/higher-ranked-auto-trait-16.no_assumptions.stderr +++ b/tests/ui/async-await/higher-ranked-auto-trait-16.no_assumptions.stderr @@ -10,9 +10,7 @@ note: `{async closure@...}` must implement `AsyncFnOnce<(&mut Ctxt<'1>,)>`, for --> $DIR/higher-ranked-auto-trait-16.rs:8:19 | LL | fn assert_send(_: T) {} - | ----------- ^^^^ unsatisfied where-clause on `assert_send` - | | - | due to a where-clause on `assert_send` + | ^^^^ required by this bound in `assert_send` = note: ...but it actually implements `AsyncFnOnce<(&mut Ctxt<'_>,)>` error: implementation of `AsyncFnOnce` is not general enough @@ -27,9 +25,7 @@ note: `{async closure@...}` must implement `AsyncFnOnce<(&mut Ctxt<'1>,)>`, for --> $DIR/higher-ranked-auto-trait-16.rs:8:19 | LL | fn assert_send(_: T) {} - | ----------- ^^^^ unsatisfied where-clause on `assert_send` - | | - | due to a where-clause on `assert_send` + | ^^^^ required by this bound in `assert_send` = note: ...but it actually implements `AsyncFnOnce<(&mut Ctxt<'_>,)>` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` diff --git a/tests/ui/async-await/higher-ranked-auto-trait-5.no_assumptions.stderr b/tests/ui/async-await/higher-ranked-auto-trait-5.no_assumptions.stderr index 6119247429e28..a95fd2179322f 100644 --- a/tests/ui/async-await/higher-ranked-auto-trait-5.no_assumptions.stderr +++ b/tests/ui/async-await/higher-ranked-auto-trait-5.no_assumptions.stderr @@ -10,10 +10,9 @@ note: `Send` would have to be implemented for the type `&'0 str`, for any lifeti --> $DIR/higher-ranked-auto-trait-5.rs:20:17 | LL | pub fn assert_send(_future: F) - | ----------- due to a where-clause on `assert_send` LL | where LL | F: Future + Send, - | ^^^^ unsatisfied where-clause on `assert_send` + | ^^^^ required by this bound in `assert_send` = note: ...but `Send` is actually implemented for the type `&'1 str`, for some specific lifetime `'1` error: aborting due to 1 previous error diff --git a/tests/ui/async-await/return-type-notation/issue-110963-early.no_assumptions.stderr b/tests/ui/async-await/return-type-notation/issue-110963-early.no_assumptions.stderr index 889d3c2948d61..63f44d676882d 100644 --- a/tests/ui/async-await/return-type-notation/issue-110963-early.no_assumptions.stderr +++ b/tests/ui/async-await/return-type-notation/issue-110963-early.no_assumptions.stderr @@ -16,10 +16,9 @@ note: `Send` would have to be implemented for the type `impl Future $DIR/issue-110963-early.rs:37:17 | LL | fn spawn(future: F) -> JoinHandle - | ----- due to a where-clause on `spawn` LL | where LL | F: Future + Send + 'static, - | ^^^^ unsatisfied where-clause on `spawn` + | ^^^^ required by this bound in `spawn` = note: ...but `Send` is actually implemented for the type `impl Future { ::check<'2>(..) }`, for some specific lifetime `'2` error: implementation of `Send` is not general enough @@ -40,10 +39,9 @@ note: `Send` would have to be implemented for the type `impl Future $DIR/issue-110963-early.rs:37:17 | LL | fn spawn(future: F) -> JoinHandle - | ----- due to a where-clause on `spawn` LL | where LL | F: Future + Send + 'static, - | ^^^^ unsatisfied where-clause on `spawn` + | ^^^^ required by this bound in `spawn` = note: ...but `Send` is actually implemented for the type `impl Future { ::check<'2>(..) }`, for some specific lifetime `'2` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` diff --git a/tests/ui/borrowck/implementation-not-general-enough-ice-133252.stderr b/tests/ui/borrowck/implementation-not-general-enough-ice-133252.stderr index beb349c94bd1a..f1a561ef88049 100644 --- a/tests/ui/borrowck/implementation-not-general-enough-ice-133252.stderr +++ b/tests/ui/borrowck/implementation-not-general-enough-ice-133252.stderr @@ -8,9 +8,7 @@ note: `LoadQuery<'0>` would have to be implemented for the type `&u8`, for any l --> $DIR/implementation-not-general-enough-ice-133252.rs:16:18 | LL | fn force_send(_: T) {} - | ---------- ^^^^ unsatisfied where-clause on `force_send` - | | - | due to a where-clause on `force_send` + | ^^^^ required by this bound in `force_send` = note: ...but `LoadQuery<'1>` is actually implemented for the type `&'1 u8`, for some specific lifetime `'1` error[E0597]: `not_static` does not live long enough diff --git a/tests/ui/closures/deduce-signature/obligation-with-leaking-placeholders.current.stderr b/tests/ui/closures/deduce-signature/obligation-with-leaking-placeholders.current.stderr index 5f8198ec6bed9..d8453534d0636 100644 --- a/tests/ui/closures/deduce-signature/obligation-with-leaking-placeholders.current.stderr +++ b/tests/ui/closures/deduce-signature/obligation-with-leaking-placeholders.current.stderr @@ -12,10 +12,9 @@ note: `Wrap<{closure@...}>` must implement `Foo<'0>`, for any lifetime `'0`... --> $DIR/obligation-with-leaking-placeholders.rs:10:22 | LL | fn needs_foo(_: T) - | --------- due to a where-clause on `needs_foo` LL | where LL | for<'a> Wrap: Foo<'a>, - | ^^^^^^^ unsatisfied where-clause on `needs_foo` + | ^^^^^^^ required by this bound in `needs_foo` note: ...but it actually implements `Foo<'1>`, for some specific lifetime `'1` --> $DIR/obligation-with-leaking-placeholders.rs:15:1 | diff --git a/tests/ui/closures/hrtb-closure-suggest-type-annotation.stderr b/tests/ui/closures/hrtb-closure-suggest-type-annotation.stderr index 5f7636bb34a0e..a8382f3dc4d76 100644 --- a/tests/ui/closures/hrtb-closure-suggest-type-annotation.stderr +++ b/tests/ui/closures/hrtb-closure-suggest-type-annotation.stderr @@ -8,10 +8,9 @@ note: closure with signature `fn(&'2 mut [u8]) -> Result` must imp --> $DIR/hrtb-closure-suggest-type-annotation.rs:8:8 | LL | fn inner(buf: &mut [u8], func: F) -> usize - | ----- due to a where-clause on `inner` LL | where LL | F: FnOnce(&mut [u8]) -> Result, - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unsatisfied where-clause on `inner` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `inner` = note: ...but it actually implements `FnOnce<(&'2 mut [u8],)>`, for some specific lifetime `'2` help: consider adding an explicit type annotation to the closure's argument | @@ -28,10 +27,9 @@ note: closure with signature `fn(&'2 mut [u8]) -> Result` must imp --> $DIR/hrtb-closure-suggest-type-annotation.rs:8:29 | LL | fn inner(buf: &mut [u8], func: F) -> usize - | ----- due to a where-clause on `inner` LL | where LL | F: FnOnce(&mut [u8]) -> Result, - | ^^^^^^^^^^^^^^^^^^^^ unsatisfied where-clause on `inner` + | ^^^^^^^^^^^^^^^^^^^^ required by this bound in `inner` = note: ...but it actually implements `FnOnce<(&'2 mut [u8],)>`, for some specific lifetime `'2` help: consider adding an explicit type annotation to the closure's argument | diff --git a/tests/ui/coroutine/auto-trait-regions.stderr b/tests/ui/coroutine/auto-trait-regions.stderr index 25f6373124d34..ea2b5cc18cda3 100644 --- a/tests/ui/coroutine/auto-trait-regions.stderr +++ b/tests/ui/coroutine/auto-trait-regions.stderr @@ -11,9 +11,7 @@ note: `&'0 OnlyFooIfStaticRef` must implement `Foo`, for any lifetime `'0`... --> $DIR/auto-trait-regions.rs:21:18 | LL | fn assert_foo(f: T) {} - | ---------- ^^^ unsatisfied where-clause on `assert_foo` - | | - | due to a where-clause on `assert_foo` + | ^^^ required by this bound in `assert_foo` = note: ...but `Foo` is actually implemented for the type `&'static OnlyFooIfStaticRef` error[E0626]: borrow may still be in use when coroutine yields @@ -61,9 +59,7 @@ note: `Foo` would have to be implemented for the type `A<'0, '1>`, for any two l --> $DIR/auto-trait-regions.rs:21:18 | LL | fn assert_foo(f: T) {} - | ---------- ^^^ unsatisfied where-clause on `assert_foo` - | | - | due to a where-clause on `assert_foo` + | ^^^ required by this bound in `assert_foo` = note: ...but `Foo` is actually implemented for the type `A<'_, '2>`, for some specific lifetime `'2` error: aborting due to 4 previous errors diff --git a/tests/ui/coroutine/resume-arg-late-bound.stderr b/tests/ui/coroutine/resume-arg-late-bound.stderr index b44a8e363128f..9211256766669 100644 --- a/tests/ui/coroutine/resume-arg-late-bound.stderr +++ b/tests/ui/coroutine/resume-arg-late-bound.stderr @@ -8,9 +8,7 @@ note: `{coroutine@...}` must implement `Coroutine<&'1 mut bool>`, for any lifeti --> $DIR/resume-arg-late-bound.rs:8:17 | LL | fn test(a: impl for<'a> Coroutine<&'a mut bool>) {} - | ---- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unsatisfied where-clause on `test` - | | - | due to a where-clause on `test` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `test` = note: ...but it actually implements `Coroutine<&'2 mut bool>`, for some specific lifetime `'2` error: aborting due to 1 previous error diff --git a/tests/ui/generic-associated-types/gat-bounds-not-checked-with-right-substitutions.stderr b/tests/ui/generic-associated-types/gat-bounds-not-checked-with-right-substitutions.stderr index 92d39c70137ce..de0882fb665d2 100644 --- a/tests/ui/generic-associated-types/gat-bounds-not-checked-with-right-substitutions.stderr +++ b/tests/ui/generic-associated-types/gat-bounds-not-checked-with-right-substitutions.stderr @@ -8,9 +8,7 @@ note: `Lengthen<&'0 str>` would have to be implemented for the type `&'a str`, f --> $DIR/gat-bounds-not-checked-with-right-substitutions.rs:12:19 | LL | type Gat<'a>: for<'b> Lengthen>; - | --- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unsatisfied where-clause on `Gat::Gat` - | | - | due to a where-clause on `Gat::Gat` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Gat::Gat` = note: ...but `Lengthen<&'1 str>` is actually implemented for the type `&'1 str`, for some specific lifetime `'1` note: required by a bound in `Gat::Gat` --> $DIR/gat-bounds-not-checked-with-right-substitutions.rs:12:19 diff --git a/tests/ui/higher-ranked/hr-fn-ptr-trait-impl-mismatch-29061.stderr b/tests/ui/higher-ranked/hr-fn-ptr-trait-impl-mismatch-29061.stderr index 16c1b69d3b053..9e5de5e6fb61b 100644 --- a/tests/ui/higher-ranked/hr-fn-ptr-trait-impl-mismatch-29061.stderr +++ b/tests/ui/higher-ranked/hr-fn-ptr-trait-impl-mismatch-29061.stderr @@ -8,9 +8,7 @@ note: `HR` would have to be implemented for the type `fn(&'0 ())`, for some spec --> $DIR/hr-fn-ptr-trait-impl-mismatch-29061.rs:15:10 | LL | fn hr(_: T) {} - | -- ^^ unsatisfied where-clause on `hr` - | | - | due to a where-clause on `hr` + | ^^ required by this bound in `hr` = note: ...but `HR` is actually implemented for the type `for<'a> fn(&'a ())` error: implementation of `NotHR` is not general enough @@ -23,9 +21,7 @@ note: `NotHR` would have to be implemented for the type `for<'a> fn(&'a ())` --> $DIR/hr-fn-ptr-trait-impl-mismatch-29061.rs:19:14 | LL | fn not_hr(_: T) {} - | ------ ^^^^^ unsatisfied where-clause on `not_hr` - | | - | due to a where-clause on `not_hr` + | ^^^^^ required by this bound in `not_hr` = note: ...but `NotHR` is actually implemented for the type `fn(&'0 ())`, for some specific lifetime `'0` error: implementation of `NotHR` is not general enough @@ -38,9 +34,7 @@ note: `NotHR` would have to be implemented for the type `for<'b> fn(&'b ())` --> $DIR/hr-fn-ptr-trait-impl-mismatch-29061.rs:19:14 | LL | fn not_hr(_: T) {} - | ------ ^^^^^ unsatisfied where-clause on `not_hr` - | | - | due to a where-clause on `not_hr` + | ^^^^^ required by this bound in `not_hr` = note: ...but `NotHR` is actually implemented for the type `fn(&'0 ())`, for some specific lifetime `'0` error: aborting due to 3 previous errors diff --git a/tests/ui/higher-ranked/hrtb-associated-type-leak-check-55731.stderr b/tests/ui/higher-ranked/hrtb-associated-type-leak-check-55731.stderr index d3e10e7a18d20..53586decee2c5 100644 --- a/tests/ui/higher-ranked/hrtb-associated-type-leak-check-55731.stderr +++ b/tests/ui/higher-ranked/hrtb-associated-type-leak-check-55731.stderr @@ -11,10 +11,9 @@ note: `DistributedIteratorMulti<&'0 ()>` would have to be implemented for the ty --> $DIR/hrtb-associated-type-leak-check-55731.rs:43:8 | LL | fn multi(_reducer: I) - | ----- due to a where-clause on `multi` LL | where LL | I: for<'a> DistributedIteratorMulti<&'a ()>, - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unsatisfied where-clause on `multi` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `multi` = note: ...but `DistributedIteratorMulti<&'1 ()>` is actually implemented for the type `Cloned<&'1 ()>`, for some specific lifetime `'1` error: aborting due to 1 previous error diff --git a/tests/ui/higher-ranked/hrtb-fn-ptr-impl-not-general-enough-57936.stderr b/tests/ui/higher-ranked/hrtb-fn-ptr-impl-not-general-enough-57936.stderr index f7a9020c59e24..f9862b8ab13a4 100644 --- a/tests/ui/higher-ranked/hrtb-fn-ptr-impl-not-general-enough-57936.stderr +++ b/tests/ui/higher-ranked/hrtb-fn-ptr-impl-not-general-enough-57936.stderr @@ -21,9 +21,7 @@ note: `X` would have to be implemented for the type `for<'a> fn(&'a ())` --> $DIR/hrtb-fn-ptr-impl-not-general-enough-57936.rs:21:16 | LL | fn indirect() { - | -------- ^ unsatisfied where-clause on `indirect` - | | - | due to a where-clause on `indirect` + | ^ required by this bound in `indirect` = note: ...but `X` is actually implemented for the type `fn(&'0 ())`, for some specific lifetime `'0` error: aborting due to 2 previous errors diff --git a/tests/ui/higher-ranked/trait-bounds/hrtb-conflate-regions.stderr b/tests/ui/higher-ranked/trait-bounds/hrtb-conflate-regions.stderr index 6700778198712..0946314f31e80 100644 --- a/tests/ui/higher-ranked/trait-bounds/hrtb-conflate-regions.stderr +++ b/tests/ui/higher-ranked/trait-bounds/hrtb-conflate-regions.stderr @@ -8,9 +8,8 @@ note: `SomeStruct` must implement `Foo<(&'0 isize, &'1 isize)>`, for any two lif --> $DIR/hrtb-conflate-regions.rs:9:15 | LL | fn want_foo2() - | --------- due to a where-clause on `want_foo2` LL | where T : for<'a,'b> Foo<(&'a isize, &'b isize)> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unsatisfied where-clause on `want_foo2` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `want_foo2` note: ...but it actually implements `Foo<(&'2 isize, &'2 isize)>`, for some specific lifetime `'2` --> $DIR/hrtb-conflate-regions.rs:22:1 | @@ -27,9 +26,8 @@ note: `SomeStruct` must implement `Foo<(&'0 isize, &'1 isize)>`, for any two lif --> $DIR/hrtb-conflate-regions.rs:9:15 | LL | fn want_foo2() - | --------- due to a where-clause on `want_foo2` LL | where T : for<'a,'b> Foo<(&'a isize, &'b isize)> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unsatisfied where-clause on `want_foo2` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `want_foo2` note: ...but it actually implements `Foo<(&'2 isize, &'2 isize)>`, for some specific lifetime `'2` --> $DIR/hrtb-conflate-regions.rs:22:1 | diff --git a/tests/ui/higher-ranked/trait-bounds/hrtb-exists-forall-trait-contravariant.stderr b/tests/ui/higher-ranked/trait-bounds/hrtb-exists-forall-trait-contravariant.stderr index e600c49d564be..8ec6646e73074 100644 --- a/tests/ui/higher-ranked/trait-bounds/hrtb-exists-forall-trait-contravariant.stderr +++ b/tests/ui/higher-ranked/trait-bounds/hrtb-exists-forall-trait-contravariant.stderr @@ -8,10 +8,9 @@ note: `()` must implement `Trait fn(&'b u32)>` --> $DIR/hrtb-exists-forall-trait-contravariant.rs:10:8 | LL | fn foo() - | --- due to a where-clause on `foo` LL | where LL | T: Trait fn(&'b u32)>, - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ unsatisfied where-clause on `foo` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `foo` note: ...but it actually implements `Trait`, for some specific lifetime `'0` --> $DIR/hrtb-exists-forall-trait-contravariant.rs:14:1 | diff --git a/tests/ui/higher-ranked/trait-bounds/hrtb-exists-forall-trait-covariant.stderr b/tests/ui/higher-ranked/trait-bounds/hrtb-exists-forall-trait-covariant.stderr index dd720d9989060..4beade083b781 100644 --- a/tests/ui/higher-ranked/trait-bounds/hrtb-exists-forall-trait-covariant.stderr +++ b/tests/ui/higher-ranked/trait-bounds/hrtb-exists-forall-trait-covariant.stderr @@ -8,10 +8,9 @@ note: `()` must implement `Trait fn(fn(&'b u32))>` --> $DIR/hrtb-exists-forall-trait-covariant.rs:10:8 | LL | fn foo() - | --- due to a where-clause on `foo` LL | where LL | T: Trait fn(fn(&'b u32))>, - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unsatisfied where-clause on `foo` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `foo` note: ...but it actually implements `Trait`, for some specific lifetime `'0` --> $DIR/hrtb-exists-forall-trait-covariant.rs:14:1 | diff --git a/tests/ui/higher-ranked/trait-bounds/hrtb-exists-forall-trait-invariant.stderr b/tests/ui/higher-ranked/trait-bounds/hrtb-exists-forall-trait-invariant.stderr index 446a3102a0938..691d5499bc175 100644 --- a/tests/ui/higher-ranked/trait-bounds/hrtb-exists-forall-trait-invariant.stderr +++ b/tests/ui/higher-ranked/trait-bounds/hrtb-exists-forall-trait-invariant.stderr @@ -8,10 +8,9 @@ note: `()` must implement `Trait fn(Cell<&'b u32>)>` --> $DIR/hrtb-exists-forall-trait-invariant.rs:12:8 | LL | fn foo() - | --- due to a where-clause on `foo` LL | where LL | T: Trait fn(Cell<&'b u32>)>, - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unsatisfied where-clause on `foo` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `foo` note: ...but it actually implements `Trait)>`, for some specific lifetime `'0` --> $DIR/hrtb-exists-forall-trait-invariant.rs:16:1 | diff --git a/tests/ui/higher-ranked/trait-bounds/hrtb-just-for-static.stderr b/tests/ui/higher-ranked/trait-bounds/hrtb-just-for-static.stderr index cdfcd30d44fb2..8e224e3447205 100644 --- a/tests/ui/higher-ranked/trait-bounds/hrtb-just-for-static.stderr +++ b/tests/ui/higher-ranked/trait-bounds/hrtb-just-for-static.stderr @@ -8,9 +8,8 @@ note: `StaticInt` must implement `Foo<&'0 isize>`, for any lifetime `'0`... --> $DIR/hrtb-just-for-static.rs:9:15 | LL | fn want_hrtb() - | --------- due to a where-clause on `want_hrtb` LL | where T : for<'a> Foo<&'a isize> - | ^^^^^^^^^^^^^^^^^^^^^^ unsatisfied where-clause on `want_hrtb` + | ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `want_hrtb` note: ...but it actually implements `Foo<&'static isize>` --> $DIR/hrtb-just-for-static.rs:22:1 | diff --git a/tests/ui/higher-ranked/trait-bounds/hrtb-perfect-forwarding.stderr b/tests/ui/higher-ranked/trait-bounds/hrtb-perfect-forwarding.stderr index da60e78d2f389..b1d725f896cf2 100644 --- a/tests/ui/higher-ranked/trait-bounds/hrtb-perfect-forwarding.stderr +++ b/tests/ui/higher-ranked/trait-bounds/hrtb-perfect-forwarding.stderr @@ -63,10 +63,9 @@ note: `T` must implement `Bar<&'0 isize>`, for any lifetime `'0`... --> $DIR/hrtb-perfect-forwarding.rs:37:8 | LL | fn foo_hrtb_bar_not<'b, T>(mut t: T) - | ---------------- due to a where-clause on `foo_hrtb_bar_not` LL | where LL | T: for<'a> Foo<&'a isize> + Bar<&'b isize>, - | ^^^^^^^^^^^^^^^^^^^^^^ unsatisfied where-clause on `foo_hrtb_bar_not` + | ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `foo_hrtb_bar_not` note: ...but it actually implements `Bar<&'1 isize>`, for some specific lifetime `'1` --> $DIR/hrtb-perfect-forwarding.rs:14:1 | diff --git a/tests/ui/higher-ranked/trait-bounds/issue-46989.stderr b/tests/ui/higher-ranked/trait-bounds/issue-46989.stderr index 23cba27a2fc00..0592e9e149f00 100644 --- a/tests/ui/higher-ranked/trait-bounds/issue-46989.stderr +++ b/tests/ui/higher-ranked/trait-bounds/issue-46989.stderr @@ -8,9 +8,7 @@ note: `Foo` would have to be implemented for the type `for<'a> fn(&'a i32)` --> $DIR/issue-46989.rs:35:18 | LL | fn assert_foo() {} - | ---------- ^^^ unsatisfied where-clause on `assert_foo` - | | - | due to a where-clause on `assert_foo` + | ^^^ required by this bound in `assert_foo` = note: ...but `Foo` is actually implemented for the type `fn(&'0 i32)`, for some specific lifetime `'0` error: aborting due to 1 previous error diff --git a/tests/ui/higher-ranked/trait-bounds/issue-59311.stderr b/tests/ui/higher-ranked/trait-bounds/issue-59311.stderr index 9145a693c95c8..d53ff3b080da5 100644 --- a/tests/ui/higher-ranked/trait-bounds/issue-59311.stderr +++ b/tests/ui/higher-ranked/trait-bounds/issue-59311.stderr @@ -8,10 +8,9 @@ note: `Trait` would have to be implemented for the type `&'a V` --> $DIR/issue-59311.rs:15:20 | LL | pub fn crash(v: &V) - | ----- due to a where-clause on `crash` LL | where LL | for<'a> &'a V: Trait + 'static, - | ^^^^^ unsatisfied where-clause on `crash` + | ^^^^^ required by this bound in `crash` = note: ...but `Trait` is actually implemented for the type `&'0 V`, for some specific lifetime `'0` error: implementation of `Trait` is not general enough @@ -24,10 +23,9 @@ note: `Trait` would have to be implemented for the type `&'a V` --> $DIR/issue-59311.rs:15:20 | LL | pub fn crash(v: &V) - | ----- due to a where-clause on `crash` LL | where LL | for<'a> &'a V: Trait + 'static, - | ^^^^^ unsatisfied where-clause on `crash` + | ^^^^^ required by this bound in `crash` = note: ...but `Trait` is actually implemented for the type `&'0 V`, for some specific lifetime `'0` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` diff --git a/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/issue-71955.current.stderr b/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/issue-71955.current.stderr index 6dd203ac806e5..2c35e1c853911 100644 --- a/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/issue-71955.current.stderr +++ b/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/issue-71955.current.stderr @@ -8,10 +8,9 @@ note: closure with signature `for<'a> fn(&'a &'2 str) -> bool` must implement `F --> $DIR/issue-71955.rs:32:9 | LL | fn foo(f1: F1, f2: F2) - | --- due to a where-clause on `foo` ... LL | F2: for<'b, 'c> FnOnce(&'b >::Output) -> bool, - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unsatisfied where-clause on `foo` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `foo` = note: ...but it actually implements `FnOnce<(&&'2 str,)>`, for some specific lifetime `'2` help: consider adding an explicit type annotation to the closure's argument | @@ -28,10 +27,9 @@ note: closure with signature `for<'a> fn(&'a &'2 str) -> bool` must implement `F --> $DIR/issue-71955.rs:32:63 | LL | fn foo(f1: F1, f2: F2) - | --- due to a where-clause on `foo` ... LL | F2: for<'b, 'c> FnOnce(&'b >::Output) -> bool, - | ^^^^ unsatisfied where-clause on `foo` + | ^^^^ required by this bound in `foo` = note: ...but it actually implements `FnOnce<(&&'2 str,)>`, for some specific lifetime `'2` help: consider adding an explicit type annotation to the closure's argument | @@ -48,10 +46,9 @@ note: closure with signature `for<'a> fn(&'a Wrapper<'2>) -> bool` must implemen --> $DIR/issue-71955.rs:32:9 | LL | fn foo(f1: F1, f2: F2) - | --- due to a where-clause on `foo` ... LL | F2: for<'b, 'c> FnOnce(&'b >::Output) -> bool, - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unsatisfied where-clause on `foo` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `foo` = note: ...but it actually implements `FnOnce<(&Wrapper<'2>,)>`, for some specific lifetime `'2` help: consider adding an explicit type annotation to the closure's argument | @@ -68,10 +65,9 @@ note: closure with signature `for<'a> fn(&'a Wrapper<'2>) -> bool` must implemen --> $DIR/issue-71955.rs:32:63 | LL | fn foo(f1: F1, f2: F2) - | --- due to a where-clause on `foo` ... LL | F2: for<'b, 'c> FnOnce(&'b >::Output) -> bool, - | ^^^^ unsatisfied where-clause on `foo` + | ^^^^ required by this bound in `foo` = note: ...but it actually implements `FnOnce<(&Wrapper<'2>,)>`, for some specific lifetime `'2` help: consider adding an explicit type annotation to the closure's argument | diff --git a/tests/ui/lifetimes/issue-105675.stderr b/tests/ui/lifetimes/issue-105675.stderr index 995c3604ca6e0..0c7c8f97de726 100644 --- a/tests/ui/lifetimes/issue-105675.stderr +++ b/tests/ui/lifetimes/issue-105675.stderr @@ -8,9 +8,7 @@ note: closure with signature `for<'a> fn(&'2 u32, &'a u32, u32)` must implement --> $DIR/issue-105675.rs:1:18 | LL | fn thing(x: impl FnOnce(&u32, &u32, u32)) {} - | ----- ^^^^^^^^^^^^^^^^^^^^^^^ unsatisfied where-clause on `thing` - | | - | due to a where-clause on `thing` + | ^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `thing` = note: ...but it actually implements `FnOnce<(&'2 u32, &u32, u32)>`, for some specific lifetime `'2` help: consider adding explicit type annotations to the closure's arguments | @@ -27,9 +25,7 @@ note: closure with signature `for<'a> fn(&'2 u32, &'a u32, u32)` must implement --> $DIR/issue-105675.rs:1:18 | LL | fn thing(x: impl FnOnce(&u32, &u32, u32)) {} - | ----- ^^^^^^^^^^^^^^^^^^^^^^^ unsatisfied where-clause on `thing` - | | - | due to a where-clause on `thing` + | ^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `thing` = note: ...but it actually implements `FnOnce<(&'2 u32, &u32, u32)>`, for some specific lifetime `'2` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` help: consider adding explicit type annotations to the closure's arguments @@ -47,9 +43,7 @@ note: closure with signature `fn(&'2 u32, &u32, u32)` must implement `FnOnce<(&' --> $DIR/issue-105675.rs:1:18 | LL | fn thing(x: impl FnOnce(&u32, &u32, u32)) {} - | ----- ^^^^^^^^^^^^^^^^^^^^^^^ unsatisfied where-clause on `thing` - | | - | due to a where-clause on `thing` + | ^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `thing` = note: ...but it actually implements `FnOnce<(&'2 u32, &u32, u32)>`, for some specific lifetime `'2` help: consider adding an explicit type annotation to the closure's argument | @@ -66,9 +60,7 @@ note: closure with signature `fn(&u32, &'2 u32, u32)` must implement `FnOnce<(&u --> $DIR/issue-105675.rs:1:18 | LL | fn thing(x: impl FnOnce(&u32, &u32, u32)) {} - | ----- ^^^^^^^^^^^^^^^^^^^^^^^ unsatisfied where-clause on `thing` - | | - | due to a where-clause on `thing` + | ^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `thing` = note: ...but it actually implements `FnOnce<(&u32, &'2 u32, u32)>`, for some specific lifetime `'2` help: consider adding an explicit type annotation to the closure's argument | @@ -85,9 +77,7 @@ note: closure with signature `fn(&'2 u32, &u32, u32)` must implement `FnOnce<(&' --> $DIR/issue-105675.rs:1:18 | LL | fn thing(x: impl FnOnce(&u32, &u32, u32)) {} - | ----- ^^^^^^^^^^^^^^^^^^^^^^^ unsatisfied where-clause on `thing` - | | - | due to a where-clause on `thing` + | ^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `thing` = note: ...but it actually implements `FnOnce<(&'2 u32, &u32, u32)>`, for some specific lifetime `'2` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` help: consider adding an explicit type annotation to the closure's argument @@ -105,9 +95,7 @@ note: closure with signature `fn(&u32, &'2 u32, u32)` must implement `FnOnce<(&u --> $DIR/issue-105675.rs:1:18 | LL | fn thing(x: impl FnOnce(&u32, &u32, u32)) {} - | ----- ^^^^^^^^^^^^^^^^^^^^^^^ unsatisfied where-clause on `thing` - | | - | due to a where-clause on `thing` + | ^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `thing` = note: ...but it actually implements `FnOnce<(&u32, &'2 u32, u32)>`, for some specific lifetime `'2` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` help: consider adding an explicit type annotation to the closure's argument diff --git a/tests/ui/lifetimes/issue-79187-2.stderr b/tests/ui/lifetimes/issue-79187-2.stderr index 4b2799812fe90..adc64984a05e9 100644 --- a/tests/ui/lifetimes/issue-79187-2.stderr +++ b/tests/ui/lifetimes/issue-79187-2.stderr @@ -8,9 +8,7 @@ note: closure with signature `fn(&'2 i32) -> &i32` must implement `FnOnce<(&'1 i --> $DIR/issue-79187-2.rs:5:21 | LL | fn take_foo(_: impl Foo) {} - | -------- ^^^ unsatisfied where-clause on `take_foo` - | | - | due to a where-clause on `take_foo` + | ^^^ required by this bound in `take_foo` = note: ...but it actually implements `FnOnce<(&'2 i32,)>`, for some specific lifetime `'2` help: consider adding an explicit type annotation to the closure's argument | @@ -27,9 +25,7 @@ note: closure with signature `fn(&'2 i32) -> &i32` must implement `Fn<(&'1 i32,) --> $DIR/issue-79187-2.rs:5:21 | LL | fn take_foo(_: impl Foo) {} - | -------- ^^^ unsatisfied where-clause on `take_foo` - | | - | due to a where-clause on `take_foo` + | ^^^ required by this bound in `take_foo` = note: ...but it actually implements `Fn<(&'2 i32,)>`, for some specific lifetime `'2` help: consider adding an explicit type annotation to the closure's argument | diff --git a/tests/ui/lifetimes/issue-79187.stderr b/tests/ui/lifetimes/issue-79187.stderr index 2377c4d5ba5f3..5e9602f80baf1 100644 --- a/tests/ui/lifetimes/issue-79187.stderr +++ b/tests/ui/lifetimes/issue-79187.stderr @@ -8,9 +8,7 @@ note: closure with signature `fn(&'2 u32)` must implement `FnOnce<(&'1 u32,)>`, --> $DIR/issue-79187.rs:1:18 | LL | fn thing(x: impl FnOnce(&u32)) {} - | ----- ^^^^^^^^^^^^ unsatisfied where-clause on `thing` - | | - | due to a where-clause on `thing` + | ^^^^^^^^^^^^ required by this bound in `thing` = note: ...but it actually implements `FnOnce<(&'2 u32,)>`, for some specific lifetime `'2` help: consider adding an explicit type annotation to the closure's argument | @@ -27,9 +25,7 @@ note: closure with signature `fn(&'2 u32)` must implement `FnOnce<(&'1 u32,)>`, --> $DIR/issue-79187.rs:1:18 | LL | fn thing(x: impl FnOnce(&u32)) {} - | ----- ^^^^^^^^^^^^ unsatisfied where-clause on `thing` - | | - | due to a where-clause on `thing` + | ^^^^^^^^^^^^ required by this bound in `thing` = note: ...but it actually implements `FnOnce<(&'2 u32,)>`, for some specific lifetime `'2` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` help: consider adding an explicit type annotation to the closure's argument diff --git a/tests/ui/lifetimes/lifetime-errors/issue_74400.stderr b/tests/ui/lifetimes/lifetime-errors/issue_74400.stderr index 5670dc4ea00f7..d9df584bebf73 100644 --- a/tests/ui/lifetimes/lifetime-errors/issue_74400.stderr +++ b/tests/ui/lifetimes/lifetime-errors/issue_74400.stderr @@ -52,9 +52,7 @@ note: `fn(&'2 T) -> &'2 T {identity::<&'2 T>}` must implement `Fn<(&'1 T,)>`, fo --> $DIR/issue_74400.rs:8:34 | LL | fn f(data: &[T], key: impl Fn(&T) -> S) { - | - ^^^^^^^^^^^ unsatisfied where-clause on `f` - | | - | due to a where-clause on `f` + | ^^^^^^^^^^^ required by this bound in `f` = note: ...but it actually implements `Fn<(&'2 T,)>`, for some specific lifetime `'2` error: implementation of `FnOnce` is not general enough @@ -67,7 +65,7 @@ note: `fn(&'2 T) -> &'2 T {identity::<&'2 T>}` must implement `FnOnce<(&'1 T,)>` --> $DIR/issue_74400.rs:8:44 | LL | fn f(data: &[T], key: impl Fn(&T) -> S) { - | - due to a where-clause on `f` ^ unsatisfied where-clause on `f` + | ^ required by this bound in `f` = note: ...but it actually implements `FnOnce<(&'2 T,)>`, for some specific lifetime `'2` error: aborting due to 5 previous errors diff --git a/tests/ui/mismatched_types/closure-arg-type-mismatch.stderr b/tests/ui/mismatched_types/closure-arg-type-mismatch.stderr index 72945d962a570..15c37059416af 100644 --- a/tests/ui/mismatched_types/closure-arg-type-mismatch.stderr +++ b/tests/ui/mismatched_types/closure-arg-type-mismatch.stderr @@ -73,9 +73,7 @@ note: `fn(*mut &'2 u32)` must implement `Fn<(*mut &'1 u32,)>`, for any lifetime --> $DIR/closure-arg-type-mismatch.rs:8:11 | LL | fn baz(_: F) {} - | --- ^^^^^^^^^^^^^ unsatisfied where-clause on `baz` - | | - | due to a where-clause on `baz` + | ^^^^^^^^^^^^^ required by this bound in `baz` = note: ...but it actually implements `Fn<(*mut &'2 u32,)>`, for some specific lifetime `'2` error: implementation of `FnOnce` is not general enough @@ -88,9 +86,7 @@ note: `fn(*mut &'2 u32)` must implement `FnOnce<(*mut &'1 u32,)>`, for any lifet --> $DIR/closure-arg-type-mismatch.rs:8:11 | LL | fn baz(_: F) {} - | --- ^^^^^^^^^^^^^ unsatisfied where-clause on `baz` - | | - | due to a where-clause on `baz` + | ^^^^^^^^^^^^^ required by this bound in `baz` = note: ...but it actually implements `FnOnce<(*mut &'2 u32,)>`, for some specific lifetime `'2` error: aborting due to 6 previous errors diff --git a/tests/ui/mismatched_types/closure-mismatch.current.stderr b/tests/ui/mismatched_types/closure-mismatch.current.stderr index 0249537dcba54..ad734c4e77ea6 100644 --- a/tests/ui/mismatched_types/closure-mismatch.current.stderr +++ b/tests/ui/mismatched_types/closure-mismatch.current.stderr @@ -8,9 +8,7 @@ note: closure with signature `fn(&'2 ())` must implement `FnOnce<(&'1 (),)>`, fo --> $DIR/closure-mismatch.rs:9:11 | LL | fn baz(_: T) {} - | --- ^^^ unsatisfied where-clause on `baz` - | | - | due to a where-clause on `baz` + | ^^^ required by this bound in `baz` = note: ...but it actually implements `FnOnce<(&'2 (),)>`, for some specific lifetime `'2` help: consider adding an explicit type annotation to the closure's argument | @@ -27,9 +25,7 @@ note: closure with signature `fn(&'2 ())` must implement `Fn<(&'1 (),)>`, for an --> $DIR/closure-mismatch.rs:9:11 | LL | fn baz(_: T) {} - | --- ^^^ unsatisfied where-clause on `baz` - | | - | due to a where-clause on `baz` + | ^^^ required by this bound in `baz` = note: ...but it actually implements `Fn<(&'2 (),)>`, for some specific lifetime `'2` help: consider adding an explicit type annotation to the closure's argument | @@ -46,9 +42,7 @@ note: closure with signature `fn(&'2 ())` must implement `FnOnce<(&'1 (),)>`, fo --> $DIR/closure-mismatch.rs:9:11 | LL | fn baz(_: T) {} - | --- ^^^ unsatisfied where-clause on `baz` - | | - | due to a where-clause on `baz` + | ^^^ required by this bound in `baz` = note: ...but it actually implements `FnOnce<(&'2 (),)>`, for some specific lifetime `'2` help: consider adding an explicit type annotation to the closure's argument | @@ -65,9 +59,7 @@ note: closure with signature `fn(&'2 ())` must implement `Fn<(&'1 (),)>`, for an --> $DIR/closure-mismatch.rs:9:11 | LL | fn baz(_: T) {} - | --- ^^^ unsatisfied where-clause on `baz` - | | - | due to a where-clause on `baz` + | ^^^ required by this bound in `baz` = note: ...but it actually implements `Fn<(&'2 (),)>`, for some specific lifetime `'2` help: consider adding an explicit type annotation to the closure's argument | diff --git a/tests/ui/nll/ice-106874.stderr b/tests/ui/nll/ice-106874.stderr index 5e60b16903b82..0b756a1795f8a 100644 --- a/tests/ui/nll/ice-106874.stderr +++ b/tests/ui/nll/ice-106874.stderr @@ -8,9 +8,7 @@ note: closure with signature `fn(&'0 mut V)` must implement `FnOnce<(&mut V,)>`, --> $DIR/ice-106874.rs:28:10 | LL | struct B(Rc); - | - ^ unsatisfied where-clause on `B` - | | - | due to a where-clause on `B` + | ^ required by this bound in `B` = note: ...but it actually implements `FnOnce<(&'1 mut V,)>`, for some specific lifetime `'1` help: consider adding an explicit type annotation to the closure's argument | @@ -27,9 +25,7 @@ note: closure with signature `fn(&'0 mut V)` must implement `FnOnce<(&mut V,)>`, --> $DIR/ice-106874.rs:28:10 | LL | struct B(Rc); - | - ^ unsatisfied where-clause on `B` - | | - | due to a where-clause on `B` + | ^ required by this bound in `B` = note: ...but it actually implements `FnOnce<(&'1 mut V,)>`, for some specific lifetime `'1` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` help: consider adding an explicit type annotation to the closure's argument @@ -85,11 +81,9 @@ LL | A(B(C::new(D::new(move |st| f(st))))) | note: closure with signature `fn(&'2 mut V)` must implement `FnOnce<(&'1 mut V,)>`, for any lifetime `'1`... --> $SRC_DIR/alloc/src/rcs/rc.rs:LL:COL - | - = note: due to a where-clause on `Rc` ::: $SRC_DIR/alloc/src/rcs/rc.rs:LL:COL | - = note: unsatisfied where-clause on `Rc` + = note: required by this bound in `Rc` = note: ...but it actually implements `FnOnce<(&'2 mut V,)>`, for some specific lifetime `'2` help: consider adding an explicit type annotation to the closure's argument | @@ -104,11 +98,9 @@ LL | A(B(C::new(D::new(move |st| f(st))))) | note: closure with signature `fn(&'2 mut V)` must implement `Fn<(&'1 mut V,)>`, for any lifetime `'1`... --> $SRC_DIR/alloc/src/rcs/rc.rs:LL:COL - | - = note: due to a where-clause on `Rc` ::: $SRC_DIR/alloc/src/rcs/rc.rs:LL:COL | - = note: unsatisfied where-clause on `Rc` + = note: required by this bound in `Rc` = note: ...but it actually implements `Fn<(&'2 mut V,)>`, for some specific lifetime `'2` help: consider adding an explicit type annotation to the closure's argument | @@ -125,9 +117,7 @@ note: closure with signature `fn(&'2 mut V)` must implement `FnOnce<(&'1 mut V,) --> $DIR/ice-106874.rs:28:10 | LL | struct B(Rc); - | - ^ unsatisfied where-clause on `B` - | | - | due to a where-clause on `B` + | ^ required by this bound in `B` = note: ...but it actually implements `FnOnce<(&'2 mut V,)>`, for some specific lifetime `'2` help: consider adding an explicit type annotation to the closure's argument | @@ -144,9 +134,7 @@ note: closure with signature `fn(&'2 mut V)` must implement `Fn<(&'1 mut V,)>`, --> $DIR/ice-106874.rs:28:10 | LL | struct B(Rc); - | - ^ unsatisfied where-clause on `B` - | | - | due to a where-clause on `B` + | ^ required by this bound in `B` = note: ...but it actually implements `Fn<(&'2 mut V,)>`, for some specific lifetime `'2` help: consider adding an explicit type annotation to the closure's argument | diff --git a/tests/ui/nll/issue-54302-cases.stderr b/tests/ui/nll/issue-54302-cases.stderr index 8d45fc4db9c69..0ebd0293eccca 100644 --- a/tests/ui/nll/issue-54302-cases.stderr +++ b/tests/ui/nll/issue-54302-cases.stderr @@ -8,7 +8,7 @@ note: `Foo<'static, u32>` would have to be implemented for the type `&'0 u32`, f --> $DIR/issue-54302-cases.rs:51:8 | LL | fn ref_foo(&self) -> &'static T; - | ^^^^^^^ due to a where-clause on `RefFoo::ref_foo` + | ^^^^^^^ required due to a bound in `RefFoo::ref_foo` = note: ...but `Foo<'_, u32>` is actually implemented for the type `&'1 u32`, for some specific lifetime `'1` error: implementation of `Foo` is not general enough @@ -21,7 +21,7 @@ note: `Foo<'static, i32>` would have to be implemented for the type `&'0 i32`, f --> $DIR/issue-54302-cases.rs:51:8 | LL | fn ref_foo(&self) -> &'static T; - | ^^^^^^^ due to a where-clause on `RefFoo::ref_foo` + | ^^^^^^^ required due to a bound in `RefFoo::ref_foo` = note: ...but `Foo<'_, i32>` is actually implemented for the type `&'1 i32`, for some specific lifetime `'1` error: implementation of `Foo` is not general enough @@ -34,7 +34,7 @@ note: `Foo<'static, u64>` would have to be implemented for the type `&'0 u64`, f --> $DIR/issue-54302-cases.rs:51:8 | LL | fn ref_foo(&self) -> &'static T; - | ^^^^^^^ due to a where-clause on `RefFoo::ref_foo` + | ^^^^^^^ required due to a bound in `RefFoo::ref_foo` = note: ...but `Foo<'_, u64>` is actually implemented for the type `&'1 u64`, for some specific lifetime `'1` error: implementation of `Foo` is not general enough @@ -47,7 +47,7 @@ note: `Foo<'static, i64>` would have to be implemented for the type `&'0 i64`, f --> $DIR/issue-54302-cases.rs:51:8 | LL | fn ref_foo(&self) -> &'static T; - | ^^^^^^^ due to a where-clause on `RefFoo::ref_foo` + | ^^^^^^^ required due to a bound in `RefFoo::ref_foo` = note: ...but `Foo<'_, i64>` is actually implemented for the type `&'1 i64`, for some specific lifetime `'1` error: aborting due to 4 previous errors diff --git a/tests/ui/nll/missing-universe-cause-issue-114907.stderr b/tests/ui/nll/missing-universe-cause-issue-114907.stderr index 74e240122aa70..c9b5eb8230a0f 100644 --- a/tests/ui/nll/missing-universe-cause-issue-114907.stderr +++ b/tests/ui/nll/missing-universe-cause-issue-114907.stderr @@ -8,9 +8,7 @@ note: closure with signature `fn(&'2 ())` must implement `FnOnce<(&'1 (),)>`, fo --> $DIR/missing-universe-cause-issue-114907.rs:27:14 | LL | fn accept(_: C) -> Handshake> { - | ------ ^^^^^^^^^^^ unsatisfied where-clause on `accept` - | | - | due to a where-clause on `accept` + | ^^^^^^^^^^^ required by this bound in `accept` = note: ...but it actually implements `FnOnce<(&'2 (),)>`, for some specific lifetime `'2` help: consider adding an explicit type annotation to the closure's argument | @@ -27,9 +25,7 @@ note: closure with signature `fn(&'2 ())` must implement `FnOnce<(&'1 (),)>`, fo --> $DIR/missing-universe-cause-issue-114907.rs:27:14 | LL | fn accept(_: C) -> Handshake> { - | ------ ^^^^^^^^^^^ unsatisfied where-clause on `accept` - | | - | due to a where-clause on `accept` + | ^^^^^^^^^^^ required by this bound in `accept` = note: ...but it actually implements `FnOnce<(&'2 (),)>`, for some specific lifetime `'2` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` help: consider adding an explicit type annotation to the closure's argument @@ -47,9 +43,7 @@ note: closure with signature `fn(&'2 ())` must implement `FnOnce<(&'1 (),)>`, fo --> $DIR/missing-universe-cause-issue-114907.rs:20:21 | LL | struct Handshake { - | --------- ^^^^ unsatisfied where-clause on `Handshake` - | | - | due to a where-clause on `Handshake` + | ^^^^ required by this bound in `Handshake` = note: ...but it actually implements `FnOnce<(&'2 (),)>`, for some specific lifetime `'2` help: consider adding an explicit type annotation to the closure's argument | @@ -66,9 +60,7 @@ note: closure with signature `fn(&'2 ())` must implement `FnOnce<(&'1 (),)>`, fo --> $DIR/missing-universe-cause-issue-114907.rs:20:21 | LL | struct Handshake { - | --------- ^^^^ unsatisfied where-clause on `Handshake` - | | - | due to a where-clause on `Handshake` + | ^^^^ required by this bound in `Handshake` = note: ...but it actually implements `FnOnce<(&'2 (),)>`, for some specific lifetime `'2` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` help: consider adding an explicit type annotation to the closure's argument diff --git a/tests/ui/nll/polonius/location-insensitive-scopes-issue-117146.nll.stderr b/tests/ui/nll/polonius/location-insensitive-scopes-issue-117146.nll.stderr index 4538c51a2bb52..3c1beb5021af8 100644 --- a/tests/ui/nll/polonius/location-insensitive-scopes-issue-117146.nll.stderr +++ b/tests/ui/nll/polonius/location-insensitive-scopes-issue-117146.nll.stderr @@ -34,9 +34,7 @@ note: closure with signature `fn(&'2 ()) -> &()` must implement `Fn<(&'1 (),)>`, --> $DIR/location-insensitive-scopes-issue-117146.rs:21:11 | LL | fn bad &()>(_: F) {} - | --- ^^^^^^^^^^^^^^ unsatisfied where-clause on `bad` - | | - | due to a where-clause on `bad` + | ^^^^^^^^^^^^^^ required by this bound in `bad` = note: ...but it actually implements `Fn<(&'2 (),)>`, for some specific lifetime `'2` help: consider adding an explicit type annotation to the closure's argument | @@ -53,9 +51,7 @@ note: closure with signature `fn(&'2 ()) -> &()` must implement `FnOnce<(&'1 (), --> $DIR/location-insensitive-scopes-issue-117146.rs:21:22 | LL | fn bad &()>(_: F) {} - | --- ^^^ unsatisfied where-clause on `bad` - | | - | due to a where-clause on `bad` + | ^^^ required by this bound in `bad` = note: ...but it actually implements `FnOnce<(&'2 (),)>`, for some specific lifetime `'2` help: consider adding an explicit type annotation to the closure's argument | diff --git a/tests/ui/nll/polonius/location-insensitive-scopes-issue-117146.polonius.stderr b/tests/ui/nll/polonius/location-insensitive-scopes-issue-117146.polonius.stderr index 4538c51a2bb52..3c1beb5021af8 100644 --- a/tests/ui/nll/polonius/location-insensitive-scopes-issue-117146.polonius.stderr +++ b/tests/ui/nll/polonius/location-insensitive-scopes-issue-117146.polonius.stderr @@ -34,9 +34,7 @@ note: closure with signature `fn(&'2 ()) -> &()` must implement `Fn<(&'1 (),)>`, --> $DIR/location-insensitive-scopes-issue-117146.rs:21:11 | LL | fn bad &()>(_: F) {} - | --- ^^^^^^^^^^^^^^ unsatisfied where-clause on `bad` - | | - | due to a where-clause on `bad` + | ^^^^^^^^^^^^^^ required by this bound in `bad` = note: ...but it actually implements `Fn<(&'2 (),)>`, for some specific lifetime `'2` help: consider adding an explicit type annotation to the closure's argument | @@ -53,9 +51,7 @@ note: closure with signature `fn(&'2 ()) -> &()` must implement `FnOnce<(&'1 (), --> $DIR/location-insensitive-scopes-issue-117146.rs:21:22 | LL | fn bad &()>(_: F) {} - | --- ^^^ unsatisfied where-clause on `bad` - | | - | due to a where-clause on `bad` + | ^^^ required by this bound in `bad` = note: ...but it actually implements `FnOnce<(&'2 (),)>`, for some specific lifetime `'2` help: consider adding an explicit type annotation to the closure's argument | diff --git a/tests/ui/nll/relate_tys/impl-fn-ignore-binder-via-bottom.stderr b/tests/ui/nll/relate_tys/impl-fn-ignore-binder-via-bottom.stderr index e03e0cd465158..1917b5ca9cea1 100644 --- a/tests/ui/nll/relate_tys/impl-fn-ignore-binder-via-bottom.stderr +++ b/tests/ui/nll/relate_tys/impl-fn-ignore-binder-via-bottom.stderr @@ -8,7 +8,7 @@ note: `Y` would have to be implemented for the type `for<'a> fn(&'a ())` --> $DIR/impl-fn-ignore-binder-via-bottom.rs:18:8 | LL | fn make_f() -> Self::F; - | ^^^^^^ due to a where-clause on `Y::make_f` + | ^^^^^^ required due to a bound in `Y::make_f` = note: ...but `Y` is actually implemented for the type `fn(&'0 ())`, for some specific lifetime `'0` error: implementation of `Y` is not general enough @@ -21,7 +21,7 @@ note: `Y` would have to be implemented for the type `for<'a> fn(&'a ())` --> $DIR/impl-fn-ignore-binder-via-bottom.rs:16:7 | LL | trait Y { - | ^ due to a where-clause on `Y` + | ^ required due to a bound in `Y` = note: ...but `Y` is actually implemented for the type `fn(&'0 ())`, for some specific lifetime `'0` error: implementation of `Y` is not general enough diff --git a/tests/ui/unboxed-closures/issue-30906.stderr b/tests/ui/unboxed-closures/issue-30906.stderr index 5d5d712c6e3e4..252ee8d85da9d 100644 --- a/tests/ui/unboxed-closures/issue-30906.stderr +++ b/tests/ui/unboxed-closures/issue-30906.stderr @@ -8,9 +8,7 @@ note: `fn(&'2 str) -> T` must implement `FnOnce<(&'1 str,)>`, for any lifetime ` --> $DIR/issue-30906.rs:3:12 | LL | fn test FnOnce<(&'x str,)>>(_: F) {} - | ---- ^^^^^^^^^^^^^^^^^^^^^^^^^^ unsatisfied where-clause on `test` - | | - | due to a where-clause on `test` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `test` = note: ...but it actually implements `FnOnce<(&'2 str,)>`, for some specific lifetime `'2` error: aborting due to 1 previous error diff --git a/tests/ui/where-clauses/where-for-self-2.stderr b/tests/ui/where-clauses/where-for-self-2.stderr index 7c7af181f601b..1b172f2a57f3c 100644 --- a/tests/ui/where-clauses/where-for-self-2.stderr +++ b/tests/ui/where-clauses/where-for-self-2.stderr @@ -8,10 +8,9 @@ note: `&'0 u32` must implement `Bar`, for any lifetime `'0`... --> $DIR/where-for-self-2.rs:18:20 | LL | fn foo(x: &T) - | --- due to a where-clause on `foo` LL | where LL | for<'a> &'a T: Bar, - | ^^^ unsatisfied where-clause on `foo` + | ^^^ required by this bound in `foo` = note: ...but `Bar` is actually implemented for the type `&'static u32` error: aborting due to 1 previous error From ca762cfe3b4d9112389a92b25a3755adbe6f78d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Wed, 30 Sep 2026 23:14:38 +0000 Subject: [PATCH 4/5] Remove redundant information --- .../nice_region_error/placeholder_error.rs | 24 ++++++++++++------- ...ot-checked-with-right-substitutions.stderr | 6 ----- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/placeholder_error.rs b/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/placeholder_error.rs index 9cf38a23bf295..1cecc2c5de448 100644 --- a/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/placeholder_error.rs +++ b/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/placeholder_error.rs @@ -393,15 +393,21 @@ impl<'tcx> NiceRegionError<'_, 'tcx> { let mut current_code = cause.code(); let mut coroutine_def_id = None; if cause.body_def_id != CRATE_DEF_ID { - self.cx.note_obligation_cause_code( - cause.body_def_id, - &mut err, - actual_trait_ref, - self.tcx().param_env(cause.body_def_id), - cause.code(), - &mut vec![], - &mut Default::default(), - ); + if let ObligationCauseCode::WhereClause(..) + | ObligationCauseCode::WhereClauseInExpr(..) = *code + { + // Do not point at the same bound twice. + } else { + self.cx.note_obligation_cause_code( + cause.body_def_id, + &mut err, + actual_trait_ref, + self.tcx().param_env(cause.body_def_id), + cause.code(), + &mut vec![], + &mut Default::default(), + ); + } } loop { diff --git a/tests/ui/generic-associated-types/gat-bounds-not-checked-with-right-substitutions.stderr b/tests/ui/generic-associated-types/gat-bounds-not-checked-with-right-substitutions.stderr index de0882fb665d2..fe84512e6f12e 100644 --- a/tests/ui/generic-associated-types/gat-bounds-not-checked-with-right-substitutions.stderr +++ b/tests/ui/generic-associated-types/gat-bounds-not-checked-with-right-substitutions.stderr @@ -10,12 +10,6 @@ note: `Lengthen<&'0 str>` would have to be implemented for the type `&'a str`, f LL | type Gat<'a>: for<'b> Lengthen>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Gat::Gat` = note: ...but `Lengthen<&'1 str>` is actually implemented for the type `&'1 str`, for some specific lifetime `'1` -note: required by a bound in `Gat::Gat` - --> $DIR/gat-bounds-not-checked-with-right-substitutions.rs:12:19 - | -LL | trait Gat { -LL | type Gat<'a>: for<'b> Lengthen>; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Gat::Gat` error: aborting due to 1 previous error From 337f98dd5582fdc1552bc76df6060a18f00f9145 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Wed, 30 Sep 2026 23:21:26 +0000 Subject: [PATCH 5/5] Tweak note to include trait/impl when appropriate ``` error: implementation of `Lengthen` is not general enough --> $DIR/gat-bounds-not-checked-with-right-substitutions.rs:20:20 | LL | type Gat<'a> = &'a str; | ^^^^^^^ | note: `Lengthen<&'0 str>` would have to be implemented for the type `&'a str`, for any lifetime `'0`... --> $DIR/gat-bounds-not-checked-with-right-substitutions.rs:12:19 | LL | trait Gat { LL | type Gat<'a>: for<'b> Lengthen>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Gat::Gat` = note: ...but `Lengthen<&'1 str>` is actually implemented for the type `&'1 str`, for some specific lifetime `'1` ``` --- compiler/rustc_trait_selection/src/diagnostics.rs | 6 +++++- .../infer/nice_region_error/placeholder_error.rs | 15 ++++++++++++--- ...ds-not-checked-with-right-substitutions.stderr | 1 + tests/ui/nll/issue-54302-cases.stderr | 4 ++++ .../impl-fn-ignore-binder-via-bottom.stderr | 2 ++ 5 files changed, 24 insertions(+), 4 deletions(-) diff --git a/compiler/rustc_trait_selection/src/diagnostics.rs b/compiler/rustc_trait_selection/src/diagnostics.rs index 72b57c6af99d5..d453b3c809860 100644 --- a/compiler/rustc_trait_selection/src/diagnostics.rs +++ b/compiler/rustc_trait_selection/src/diagnostics.rs @@ -1094,10 +1094,11 @@ impl<'tcx> ActualImplExplNotes<'tcx> { lifetime_2: usize, satisfy_span: Option, item_span: Option, + outer_span: Option, item_name: String, ) -> Self { let label = format!("required by this bound in `{item_name}`"); - let span = match (satisfy_span, item_span) { + let mut span = match (satisfy_span, item_span) { (Some(satisfy_span), Some(item_span)) => { let mut span = MultiSpan::from(satisfy_span); span.push_span_label(satisfy_span, label); @@ -1117,6 +1118,9 @@ impl<'tcx> ActualImplExplNotes<'tcx> { } _ => MultiSpan::from(vec![]), }; + if let Some(outer) = outer_span { + span.push_span_context(outer); + } match (kind, lt_kind) { (ActualImplExpectedKind::Signature, ActualImplExpectedLifetimeKind::Two) => { Self::ExpectedSignatureTwo { span, ty_or_sig, trait_path, lifetime_1, lifetime_2 } diff --git a/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/placeholder_error.rs b/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/placeholder_error.rs index 1cecc2c5de448..fecf41c84a0e2 100644 --- a/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/placeholder_error.rs +++ b/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/placeholder_error.rs @@ -3,7 +3,7 @@ use std::fmt; use rustc_data_structures::intern::Interned; use rustc_errors::{Applicability, Diag, IntoDiagArg}; use rustc_hir as hir; -use rustc_hir::def::Namespace; +use rustc_hir::def::{DefKind, Namespace}; use rustc_hir::def_id::{CRATE_DEF_ID, DefId}; use rustc_middle::ty::error::ExpectedFound; use rustc_middle::ty::print::{FmtPrinter, Print, PrintTraitRefExt as _, RegionHighlightMode}; @@ -279,11 +279,12 @@ impl<'tcx> NiceRegionError<'_, 'tcx> { _ => break, } } - let (mut satisfy_span, mut item_span, dup_span, item_name) = + let (mut satisfy_span, mut item_span, outer_span, dup_span, item_name) = if let ObligationCauseCode::WhereClause(def_id, span) | ObligationCauseCode::WhereClauseInExpr(def_id, span, ..) = *code && def_id != CRATE_DEF_ID.to_def_id() { + let parent = self.tcx().parent(def_id); ( Some(span), Some( @@ -291,11 +292,16 @@ impl<'tcx> NiceRegionError<'_, 'tcx> { .opt_item_ident(def_id) .map_or_else(|| self.tcx().def_span(def_id), |n| n.span), ), + if let DefKind::Trait | DefKind::Impl { .. } = self.tcx().def_kind(parent) { + Some(self.tcx().def_span(parent).shrink_to_lo()) + } else { + None + }, None, self.tcx().def_path_str(def_id), ) } else { - (None, None, Some(span), String::new()) + (None, None, None, Some(span), String::new()) }; if let Some(span) = satisfy_span && span.is_dummy() @@ -380,6 +386,7 @@ impl<'tcx> NiceRegionError<'_, 'tcx> { any_self_ty_has_vid, satisfy_span, item_span, + outer_span, item_name, ); @@ -510,6 +517,7 @@ impl<'tcx> NiceRegionError<'_, 'tcx> { any_self_ty_has_vid: bool, satisfy_span: Option, item_span: Option, + outer_span: Option, item_name: String, ) -> Vec> { // The weird thing here with the `maybe_highlighting_region` calls and the @@ -614,6 +622,7 @@ impl<'tcx> NiceRegionError<'_, 'tcx> { lifetime_2, satisfy_span, item_span, + outer_span, item_name, ); diff --git a/tests/ui/generic-associated-types/gat-bounds-not-checked-with-right-substitutions.stderr b/tests/ui/generic-associated-types/gat-bounds-not-checked-with-right-substitutions.stderr index fe84512e6f12e..9e56955aff17b 100644 --- a/tests/ui/generic-associated-types/gat-bounds-not-checked-with-right-substitutions.stderr +++ b/tests/ui/generic-associated-types/gat-bounds-not-checked-with-right-substitutions.stderr @@ -7,6 +7,7 @@ LL | type Gat<'a> = &'a str; note: `Lengthen<&'0 str>` would have to be implemented for the type `&'a str`, for any lifetime `'0`... --> $DIR/gat-bounds-not-checked-with-right-substitutions.rs:12:19 | +LL | trait Gat { LL | type Gat<'a>: for<'b> Lengthen>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Gat::Gat` = note: ...but `Lengthen<&'1 str>` is actually implemented for the type `&'1 str`, for some specific lifetime `'1` diff --git a/tests/ui/nll/issue-54302-cases.stderr b/tests/ui/nll/issue-54302-cases.stderr index 0ebd0293eccca..78acd3d640eef 100644 --- a/tests/ui/nll/issue-54302-cases.stderr +++ b/tests/ui/nll/issue-54302-cases.stderr @@ -7,6 +7,7 @@ LL | >::ref_foo(a) note: `Foo<'static, u32>` would have to be implemented for the type `&'0 u32`, for any lifetime `'0`... --> $DIR/issue-54302-cases.rs:51:8 | +LL | trait RefFoo { LL | fn ref_foo(&self) -> &'static T; | ^^^^^^^ required due to a bound in `RefFoo::ref_foo` = note: ...but `Foo<'_, u32>` is actually implemented for the type `&'1 u32`, for some specific lifetime `'1` @@ -20,6 +21,7 @@ LL | >::ref_foo(a) note: `Foo<'static, i32>` would have to be implemented for the type `&'0 i32`, for any lifetime `'0`... --> $DIR/issue-54302-cases.rs:51:8 | +LL | trait RefFoo { LL | fn ref_foo(&self) -> &'static T; | ^^^^^^^ required due to a bound in `RefFoo::ref_foo` = note: ...but `Foo<'_, i32>` is actually implemented for the type `&'1 i32`, for some specific lifetime `'1` @@ -33,6 +35,7 @@ LL | >::ref_foo(a) note: `Foo<'static, u64>` would have to be implemented for the type `&'0 u64`, for any lifetime `'0`... --> $DIR/issue-54302-cases.rs:51:8 | +LL | trait RefFoo { LL | fn ref_foo(&self) -> &'static T; | ^^^^^^^ required due to a bound in `RefFoo::ref_foo` = note: ...but `Foo<'_, u64>` is actually implemented for the type `&'1 u64`, for some specific lifetime `'1` @@ -46,6 +49,7 @@ LL | >::ref_foo(a) note: `Foo<'static, i64>` would have to be implemented for the type `&'0 i64`, for any lifetime `'0`... --> $DIR/issue-54302-cases.rs:51:8 | +LL | trait RefFoo { LL | fn ref_foo(&self) -> &'static T; | ^^^^^^^ required due to a bound in `RefFoo::ref_foo` = note: ...but `Foo<'_, i64>` is actually implemented for the type `&'1 i64`, for some specific lifetime `'1` diff --git a/tests/ui/nll/relate_tys/impl-fn-ignore-binder-via-bottom.stderr b/tests/ui/nll/relate_tys/impl-fn-ignore-binder-via-bottom.stderr index 1917b5ca9cea1..af896df38aa49 100644 --- a/tests/ui/nll/relate_tys/impl-fn-ignore-binder-via-bottom.stderr +++ b/tests/ui/nll/relate_tys/impl-fn-ignore-binder-via-bottom.stderr @@ -7,6 +7,8 @@ LL | let _x = ::make_f(); note: `Y` would have to be implemented for the type `for<'a> fn(&'a ())` --> $DIR/impl-fn-ignore-binder-via-bottom.rs:18:8 | +LL | trait Y { +LL | type F; LL | fn make_f() -> Self::F; | ^^^^^^ required due to a bound in `Y::make_f` = note: ...but `Y` is actually implemented for the type `fn(&'0 ())`, for some specific lifetime `'0`