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 214a6e86d391a..d768e0bf63fba 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 @@ -275,8 +275,9 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { *err.long_ty_path() = long_ty_file; let mut suggested = false; + let mut noted_missing_impl = false; if is_try_conversion || is_question_mark { - suggested = self.try_conversion_context(&obligation, main_trait_predicate, &mut err); + (suggested, noted_missing_impl) = self.try_conversion_context(&obligation, main_trait_predicate, &mut err); } if let Some(ret_span) = self.return_type_span(&obligation) { @@ -335,6 +336,11 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { return err.emit(); } + let ty_span = match leaf_trait_predicate.self_ty().skip_binder().kind() { + ty::Adt(def, _) if def.did().is_local() + && !self.can_suggest_derive(&obligation, leaf_trait_predicate) => self.tcx.def_span(def.did()), + _ => DUMMY_SP, + }; if let Some(s) = label { // If it has a custom `#[rustc_on_unimplemented]` // error message, let's display it as the label! @@ -347,15 +353,28 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { // Don't say "the trait `FromResidual>` is // not implemented for `Result`". { - err.help(explanation); + // We do this just so that the JSON output's `help` position is the + // right one and not `file.rs:1:1`. The render is the same. + if ty_span == DUMMY_SP { + err.help(explanation); + } else { + err.span_help(ty_span, explanation); + } } } else if let Some(custom_explanation) = safe_transmute_explanation { err.span_label(span, custom_explanation); - } else if explanation.len() > self.tcx.sess.diagnostic_width() { + } else if (explanation.len() > self.tcx.sess.diagnostic_width() || ty_span != DUMMY_SP) && !noted_missing_impl { // Really long types don't look good as span labels, instead move it // to a `help`. err.span_label(span, "unsatisfied trait bound"); - err.help(explanation); + + // We do this just so that the JSON output's `help` position is the + // right one and not `file.rs:1:1`. The render is the same. + if ty_span == DUMMY_SP { + err.help(explanation); + } else { + err.span_help(ty_span, explanation); + } } else { err.span_label(span, explanation); } @@ -939,7 +958,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { obligation: &PredicateObligation<'tcx>, trait_pred: ty::PolyTraitPredicate<'tcx>, err: &mut Diag<'_>, - ) -> bool { + ) -> (bool, bool) { let span = obligation.cause.span; /// Look for the (direct) sub-expr of `?`, and return it if it's a `.` method call. struct FindMethodSubexprOfTry { @@ -959,21 +978,22 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { } } let hir_id = self.tcx.local_def_id_to_hir_id(obligation.cause.body_id); - let Some(body_id) = self.tcx.hir_node(hir_id).body_id() else { return false }; + let Some(body_id) = self.tcx.hir_node(hir_id).body_id() else { return (false, false) }; let ControlFlow::Break(expr) = (FindMethodSubexprOfTry { search_span: span }).visit_body(self.tcx.hir_body(body_id)) else { - return false; + return (false, false); }; let Some(typeck) = &self.typeck_results else { - return false; + return (false, false); }; let ObligationCauseCode::QuestionMark = obligation.cause.code().peel_derives() else { - return false; + return (false, false); }; let self_ty = trait_pred.skip_binder().self_ty(); let found_ty = trait_pred.skip_binder().trait_ref.args.get(1).and_then(|a| a.as_type()); - self.note_missing_impl_for_question_mark(err, self_ty, found_ty, trait_pred); + let noted_missing_impl = + self.note_missing_impl_for_question_mark(err, self_ty, found_ty, trait_pred); let mut prev_ty = self.resolve_vars_if_possible( typeck.expr_ty_adjusted_opt(expr).unwrap_or(Ty::new_misc_error(self.tcx)), @@ -1137,7 +1157,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { } prev = Some(err_ty); } - suggested + (suggested, noted_missing_impl) } fn note_missing_impl_for_question_mark( @@ -1146,7 +1166,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { self_ty: Ty<'_>, found_ty: Option>, trait_pred: ty::PolyTraitPredicate<'tcx>, - ) { + ) -> bool { match (self_ty.kind(), found_ty) { (ty::Adt(def, _), Some(ty)) if let ty::Adt(found, _) = ty.kind() @@ -1187,8 +1207,9 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { format!("`{ty}` needs to implement `Into<{self_ty}>`"), ); } - _ => {} + _ => return false, } + true } fn report_const_param_not_wf( 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 953449c67581c..e31ff8b872981 100644 --- a/compiler/rustc_trait_selection/src/error_reporting/traits/suggestions.rs +++ b/compiler/rustc_trait_selection/src/error_reporting/traits/suggestions.rs @@ -3853,59 +3853,71 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { } } - pub fn suggest_derive( + pub fn can_suggest_derive( &self, obligation: &PredicateObligation<'tcx>, - err: &mut Diag<'_>, trait_pred: ty::PolyTraitPredicate<'tcx>, - ) { + ) -> bool { if trait_pred.polarity() == ty::PredicatePolarity::Negative { - return; + return false; } let Some(diagnostic_name) = self.tcx.get_diagnostic_name(trait_pred.def_id()) else { - return; + return false; }; let (adt, args) = match trait_pred.skip_binder().self_ty().kind() { ty::Adt(adt, args) if adt.did().is_local() => (adt, args), - _ => return, + _ => return false, }; - let can_derive = { - let is_derivable_trait = match diagnostic_name { - sym::Default => !adt.is_enum(), - sym::PartialEq | sym::PartialOrd => { - let rhs_ty = trait_pred.skip_binder().trait_ref.args.type_at(1); - trait_pred.skip_binder().self_ty() == rhs_ty - } - sym::Eq | sym::Ord | sym::Clone | sym::Copy | sym::Hash | sym::Debug => true, - _ => false, - }; - is_derivable_trait && - // Ensure all fields impl the trait. - adt.all_fields().all(|field| { - let field_ty = ty::GenericArg::from(field.ty(self.tcx, args)); - let trait_args = match diagnostic_name { - sym::PartialEq | sym::PartialOrd => { - Some(field_ty) - } - _ => None, - }; - let trait_pred = trait_pred.map_bound_ref(|tr| ty::TraitPredicate { - trait_ref: ty::TraitRef::new(self.tcx, - trait_pred.def_id(), - [field_ty].into_iter().chain(trait_args), - ), - ..*tr - }); - let field_obl = Obligation::new( - self.tcx, - obligation.cause.clone(), - obligation.param_env, - trait_pred, - ); - self.predicate_must_hold_modulo_regions(&field_obl) - }) + let is_derivable_trait = match diagnostic_name { + sym::Default => !adt.is_enum(), + sym::PartialEq | sym::PartialOrd => { + let rhs_ty = trait_pred.skip_binder().trait_ref.args.type_at(1); + trait_pred.skip_binder().self_ty() == rhs_ty + } + sym::Eq | sym::Ord | sym::Clone | sym::Copy | sym::Hash | sym::Debug => true, + _ => false, + }; + is_derivable_trait && + // Ensure all fields impl the trait. + adt.all_fields().all(|field| { + let field_ty = ty::GenericArg::from(field.ty(self.tcx, args)); + let trait_args = match diagnostic_name { + sym::PartialEq | sym::PartialOrd => { + Some(field_ty) + } + _ => None, + }; + let trait_pred = trait_pred.map_bound_ref(|tr| ty::TraitPredicate { + trait_ref: ty::TraitRef::new(self.tcx, + trait_pred.def_id(), + [field_ty].into_iter().chain(trait_args), + ), + ..*tr + }); + let field_obl = Obligation::new( + self.tcx, + obligation.cause.clone(), + obligation.param_env, + trait_pred, + ); + self.predicate_must_hold_modulo_regions(&field_obl) + }) + } + + pub fn suggest_derive( + &self, + obligation: &PredicateObligation<'tcx>, + err: &mut Diag<'_>, + trait_pred: ty::PolyTraitPredicate<'tcx>, + ) { + let Some(diagnostic_name) = self.tcx.get_diagnostic_name(trait_pred.def_id()) else { + return; + }; + let adt = match trait_pred.skip_binder().self_ty().kind() { + ty::Adt(adt, _) if adt.did().is_local() => adt, + _ => return, }; - if can_derive { + if self.can_suggest_derive(obligation, trait_pred) { err.span_suggestion_verbose( self.tcx.def_span(adt.did()).shrink_to_lo(), format!( diff --git a/tests/ui-fulldeps/rustc-dev-remap.only-remap.stderr b/tests/ui-fulldeps/rustc-dev-remap.only-remap.stderr index 0c969b9c6d821..b8de9291d65fd 100644 --- a/tests/ui-fulldeps/rustc-dev-remap.only-remap.stderr +++ b/tests/ui-fulldeps/rustc-dev-remap.only-remap.stderr @@ -2,8 +2,13 @@ error[E0277]: the trait bound `NotAValidResultType: VisitorResult` is not satisf --> $DIR/rustc-dev-remap.rs:LL:COL | LL | type Result = NotAValidResultType; - | ^^^^^^^^^^^^^^^^^^^ the trait `VisitorResult` is not implemented for `NotAValidResultType` + | ^^^^^^^^^^^^^^^^^^^ unsatisfied trait bound | +help: the trait `VisitorResult` is not implemented for `NotAValidResultType` + --> $DIR/rustc-dev-remap.rs:LL:COL + | +LL | struct NotAValidResultType; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ = help: the following other types implement trait `VisitorResult`: () ControlFlow diff --git a/tests/ui-fulldeps/rustc-dev-remap.remap-unremap.stderr b/tests/ui-fulldeps/rustc-dev-remap.remap-unremap.stderr index 6ac8c3046f62b..29b43c819d07a 100644 --- a/tests/ui-fulldeps/rustc-dev-remap.remap-unremap.stderr +++ b/tests/ui-fulldeps/rustc-dev-remap.remap-unremap.stderr @@ -2,8 +2,13 @@ error[E0277]: the trait bound `NotAValidResultType: VisitorResult` is not satisf --> $DIR/rustc-dev-remap.rs:LL:COL | LL | type Result = NotAValidResultType; - | ^^^^^^^^^^^^^^^^^^^ the trait `VisitorResult` is not implemented for `NotAValidResultType` + | ^^^^^^^^^^^^^^^^^^^ unsatisfied trait bound | +help: the trait `VisitorResult` is not implemented for `NotAValidResultType` + --> $DIR/rustc-dev-remap.rs:LL:COL + | +LL | struct NotAValidResultType; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ = help: the following other types implement trait `VisitorResult`: () ControlFlow diff --git a/tests/ui-fulldeps/session-diagnostic/diagnostic-derive-doc-comment-field.stderr b/tests/ui-fulldeps/session-diagnostic/diagnostic-derive-doc-comment-field.stderr index 7377b0dfd0ac1..8b6c4b181c0fe 100644 --- a/tests/ui-fulldeps/session-diagnostic/diagnostic-derive-doc-comment-field.stderr +++ b/tests/ui-fulldeps/session-diagnostic/diagnostic-derive-doc-comment-field.stderr @@ -5,8 +5,13 @@ LL | #[derive(Diagnostic)] | ---------- required by a bound introduced by this call ... LL | arg: NotIntoDiagArg, - | ^^^^^^^^^^^^^^ the trait `IntoDiagArg` is not implemented for `NotIntoDiagArg` + | ^^^^^^^^^^^^^^ unsatisfied trait bound | +help: the trait `IntoDiagArg` is not implemented for `NotIntoDiagArg` + --> $DIR/diagnostic-derive-doc-comment-field.rs:28:1 + | +LL | struct NotIntoDiagArg; + | ^^^^^^^^^^^^^^^^^^^^^ = help: normalized in stderr note: required by a bound in `Diag::<'a, G>::arg` --> $COMPILER_DIR/rustc_errors/src/diagnostic.rs:LL:CC @@ -19,8 +24,13 @@ LL | #[derive(Subdiagnostic)] | ------------- required by a bound introduced by this call ... LL | arg: NotIntoDiagArg, - | ^^^^^^^^^^^^^^ the trait `IntoDiagArg` is not implemented for `NotIntoDiagArg` + | ^^^^^^^^^^^^^^ unsatisfied trait bound + | +help: the trait `IntoDiagArg` is not implemented for `NotIntoDiagArg` + --> $DIR/diagnostic-derive-doc-comment-field.rs:28:1 | +LL | struct NotIntoDiagArg; + | ^^^^^^^^^^^^^^^^^^^^^ = help: normalized in stderr note: required by a bound in `Diag::<'a, G>::arg` --> $COMPILER_DIR/rustc_errors/src/diagnostic.rs:LL:CC diff --git a/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr b/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr index 396abb001cee6..59b48e9f0ecc2 100644 --- a/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr +++ b/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr @@ -637,8 +637,13 @@ LL | #[derive(Diagnostic)] | ---------- required by a bound introduced by this call ... LL | other: Hello, - | ^^^^^ the trait `IntoDiagArg` is not implemented for `Hello` + | ^^^^^ unsatisfied trait bound | +help: the trait `IntoDiagArg` is not implemented for `Hello` + --> $DIR/diagnostic-derive.rs:40:1 + | +LL | struct Hello {} + | ^^^^^^^^^^^^ = help: normalized in stderr note: required by a bound in `Diag::<'a, G>::arg` --> $COMPILER_DIR/rustc_errors/src/diagnostic.rs:LL:CC diff --git a/tests/ui/associated-consts/issue-105330.stderr b/tests/ui/associated-consts/issue-105330.stderr index 725271935554c..5d6dc48e36c0b 100644 --- a/tests/ui/associated-consts/issue-105330.stderr +++ b/tests/ui/associated-consts/issue-105330.stderr @@ -53,8 +53,13 @@ error[E0277]: the trait bound `Demo: TraitWAssocConst` is not satisfied --> $DIR/issue-105330.rs:12:11 | LL | foo::()(); - | ^^^^ the trait `TraitWAssocConst` is not implemented for `Demo` + | ^^^^ unsatisfied trait bound | +help: the trait `TraitWAssocConst` is not implemented for `Demo` + --> $DIR/issue-105330.rs:4:1 + | +LL | pub struct Demo {} + | ^^^^^^^^^^^^^^^ note: required by a bound in `foo` --> $DIR/issue-105330.rs:11:11 | @@ -75,8 +80,13 @@ error[E0277]: the trait bound `Demo: TraitWAssocConst` is not satisfied --> $DIR/issue-105330.rs:20:11 | LL | foo::(); - | ^^^^ the trait `TraitWAssocConst` is not implemented for `Demo` + | ^^^^ unsatisfied trait bound + | +help: the trait `TraitWAssocConst` is not implemented for `Demo` + --> $DIR/issue-105330.rs:4:1 | +LL | pub struct Demo {} + | ^^^^^^^^^^^^^^^ note: required by a bound in `foo` --> $DIR/issue-105330.rs:11:11 | diff --git a/tests/ui/associated-types/defaults-suitability.current.stderr b/tests/ui/associated-types/defaults-suitability.current.stderr index 5e19674250f0b..0018181f480d8 100644 --- a/tests/ui/associated-types/defaults-suitability.current.stderr +++ b/tests/ui/associated-types/defaults-suitability.current.stderr @@ -73,8 +73,13 @@ error[E0277]: the trait bound `NotClone: IsU8` is not satisfied --> $DIR/defaults-suitability.rs:59:18 | LL | type Assoc = NotClone; - | ^^^^^^^^ the trait `IsU8` is not implemented for `NotClone` + | ^^^^^^^^ unsatisfied trait bound | +help: the trait `IsU8` is not implemented for `NotClone` + --> $DIR/defaults-suitability.rs:12:1 + | +LL | struct NotClone; + | ^^^^^^^^^^^^^^^ note: required by a bound in `D::Assoc` --> $DIR/defaults-suitability.rs:56:18 | diff --git a/tests/ui/associated-types/defaults-suitability.next.stderr b/tests/ui/associated-types/defaults-suitability.next.stderr index 5e19674250f0b..0018181f480d8 100644 --- a/tests/ui/associated-types/defaults-suitability.next.stderr +++ b/tests/ui/associated-types/defaults-suitability.next.stderr @@ -73,8 +73,13 @@ error[E0277]: the trait bound `NotClone: IsU8` is not satisfied --> $DIR/defaults-suitability.rs:59:18 | LL | type Assoc = NotClone; - | ^^^^^^^^ the trait `IsU8` is not implemented for `NotClone` + | ^^^^^^^^ unsatisfied trait bound | +help: the trait `IsU8` is not implemented for `NotClone` + --> $DIR/defaults-suitability.rs:12:1 + | +LL | struct NotClone; + | ^^^^^^^^^^^^^^^ note: required by a bound in `D::Assoc` --> $DIR/defaults-suitability.rs:56:18 | diff --git a/tests/ui/associated-types/issue-64855.stderr b/tests/ui/associated-types/issue-64855.stderr index d8ba1a9d07ee9..4358ab473651d 100644 --- a/tests/ui/associated-types/issue-64855.stderr +++ b/tests/ui/associated-types/issue-64855.stderr @@ -2,8 +2,13 @@ error[E0277]: the trait bound `Bar: Foo` is not satisfied --> $DIR/issue-64855.rs:9:19 | LL | pub struct Bar(::Type) where Self: ; - | ^^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `Bar` + | ^^^^^^^^^^^^^^^^^^^ unsatisfied trait bound | +help: the trait `Foo` is not implemented for `Bar` + --> $DIR/issue-64855.rs:9:1 + | +LL | pub struct Bar(::Type) where Self: ; + | ^^^^^^^^^^^^^^^^^ help: this trait has no implementations, consider adding one --> $DIR/issue-64855.rs:5:1 | diff --git a/tests/ui/associated-types/issue-65774-1.stderr b/tests/ui/associated-types/issue-65774-1.stderr index 9c77a25c4320d..3c8da0921584c 100644 --- a/tests/ui/associated-types/issue-65774-1.stderr +++ b/tests/ui/associated-types/issue-65774-1.stderr @@ -2,8 +2,13 @@ error[E0277]: the trait bound `T: MyDisplay` is not satisfied --> $DIR/issue-65774-1.rs:10:33 | LL | type MpuConfig: MyDisplay = T; - | ^ the trait `MyDisplay` is not implemented for `T` + | ^ unsatisfied trait bound | +help: the trait `MyDisplay` is not implemented for `T` + --> $DIR/issue-65774-1.rs:7:1 + | +LL | struct T; + | ^^^^^^^^ = help: the trait `MyDisplay` is implemented for `&'a mut T` note: required by a bound in `MPU::MpuConfig` --> $DIR/issue-65774-1.rs:10:21 @@ -15,8 +20,13 @@ error[E0277]: the trait bound `T: MyDisplay` is not satisfied --> $DIR/issue-65774-1.rs:44:76 | LL | let closure = |config: &mut ::MpuConfig| writer.my_write(&config); - | ^^^^^^^ the trait `MyDisplay` is not implemented for `T` + | ^^^^^^^ unsatisfied trait bound + | +help: the trait `MyDisplay` is not implemented for `T` + --> $DIR/issue-65774-1.rs:7:1 | +LL | struct T; + | ^^^^^^^^ = help: the trait `MyDisplay` is implemented for `&'a mut T` note: required for `&mut T` to implement `MyDisplay` --> $DIR/issue-65774-1.rs:5:24 diff --git a/tests/ui/associated-types/issue-65774-2.stderr b/tests/ui/associated-types/issue-65774-2.stderr index ca8a727f0fe21..82210b84992ad 100644 --- a/tests/ui/associated-types/issue-65774-2.stderr +++ b/tests/ui/associated-types/issue-65774-2.stderr @@ -2,8 +2,13 @@ error[E0277]: the trait bound `T: MyDisplay` is not satisfied --> $DIR/issue-65774-2.rs:10:33 | LL | type MpuConfig: MyDisplay = T; - | ^ the trait `MyDisplay` is not implemented for `T` + | ^ unsatisfied trait bound | +help: the trait `MyDisplay` is not implemented for `T` + --> $DIR/issue-65774-2.rs:7:1 + | +LL | struct T; + | ^^^^^^^^ = help: the trait `MyDisplay` is implemented for `&'a mut T` note: required by a bound in `MPU::MpuConfig` --> $DIR/issue-65774-2.rs:10:21 @@ -15,8 +20,13 @@ error[E0277]: the trait bound `T: MyDisplay` is not satisfied --> $DIR/issue-65774-2.rs:39:25 | LL | writer.my_write(valref) - | ^^^^^^ the trait `MyDisplay` is not implemented for `T` + | ^^^^^^ unsatisfied trait bound + | +help: the trait `MyDisplay` is not implemented for `T` + --> $DIR/issue-65774-2.rs:7:1 | +LL | struct T; + | ^^^^^^^^ = help: the trait `MyDisplay` is implemented for `&'a mut T` = note: required for the cast from `&mut T` to `&dyn MyDisplay` diff --git a/tests/ui/async-await/async-fn/impl-header.stderr b/tests/ui/async-await/async-fn/impl-header.stderr index 2fc7a900a1e22..d0cf0d822f254 100644 --- a/tests/ui/async-await/async-fn/impl-header.stderr +++ b/tests/ui/async-await/async-fn/impl-header.stderr @@ -36,7 +36,11 @@ error[E0277]: expected a `FnMut()` closure, found `F` LL | impl async Fn<()> for F {} | ^ expected an `FnMut()` closure, found `F` | - = help: the trait `FnMut()` is not implemented for `F` +help: the trait `FnMut()` is not implemented for `F` + --> $DIR/impl-header.rs:3:1 + | +LL | struct F; + | ^^^^^^^^ = note: wrap the `F` in a closure with no arguments: `|| { /* code */ }` note: required by a bound in `Fn` --> $SRC_DIR/core/src/ops/function.rs:LL:COL diff --git a/tests/ui/async-await/issue-61076.rs b/tests/ui/async-await/issue-61076.rs index f78abfd6d0f60..0a679a95970ac 100644 --- a/tests/ui/async-await/issue-61076.rs +++ b/tests/ui/async-await/issue-61076.rs @@ -4,7 +4,7 @@ use core::future::Future; use core::pin::Pin; use core::task::{Context, Poll}; -struct T; +struct T; //~ HELP the trait `Try` is not implemented for `T` struct Tuple(i32); @@ -61,11 +61,9 @@ async fn baz() -> Result<(), ()> { let t = T; t?; //~ ERROR the `?` operator can only be applied to values that implement `Try` //~^ NOTE the `?` operator cannot be applied to type `T` - //~| HELP the trait `Try` is not implemented for `T` //~| HELP consider `await`ing on the `Future` //~| NOTE in this expansion of desugaring of operator `?` //~| NOTE in this expansion of desugaring of operator `?` - //~| NOTE in this expansion of desugaring of operator `?` let _: i32 = tuple().0; //~ ERROR no field `0` diff --git a/tests/ui/async-await/issue-61076.stderr b/tests/ui/async-await/issue-61076.stderr index b8478c8d1388d..7d46abe4a66b3 100644 --- a/tests/ui/async-await/issue-61076.stderr +++ b/tests/ui/async-await/issue-61076.stderr @@ -16,14 +16,18 @@ error[E0277]: the `?` operator can only be applied to values that implement `Try LL | t?; | ^^ the `?` operator cannot be applied to type `T` | - = help: the trait `Try` is not implemented for `T` +help: the trait `Try` is not implemented for `T` + --> $DIR/issue-61076.rs:7:1 + | +LL | struct T; + | ^^^^^^^^ help: consider `await`ing on the `Future` | LL | t.await?; | ++++++ error[E0609]: no field `0` on type `impl Future` - --> $DIR/issue-61076.rs:71:26 + --> $DIR/issue-61076.rs:69:26 | LL | let _: i32 = tuple().0; | ^ field not available in `impl Future`, but it is available in its `Output` @@ -34,7 +38,7 @@ LL | let _: i32 = tuple().await.0; | ++++++ error[E0609]: no field `a` on type `impl Future` - --> $DIR/issue-61076.rs:75:28 + --> $DIR/issue-61076.rs:73:28 | LL | let _: i32 = struct_().a; | ^ field not available in `impl Future`, but it is available in its `Output` @@ -45,7 +49,7 @@ LL | let _: i32 = struct_().await.a; | ++++++ error[E0599]: no method named `method` found for opaque type `impl Future` in the current scope - --> $DIR/issue-61076.rs:79:15 + --> $DIR/issue-61076.rs:77:15 | LL | struct_().method(); | ^^^^^^ method not found in `impl Future` @@ -56,7 +60,7 @@ LL | struct_().await.method(); | ++++++ error[E0308]: mismatched types - --> $DIR/issue-61076.rs:88:9 + --> $DIR/issue-61076.rs:86:9 | LL | match tuple() { | ------- this expression has type `impl Future` diff --git a/tests/ui/async-await/issue-64130-1-sync.stderr b/tests/ui/async-await/issue-64130-1-sync.stderr index 5428d7ef71b30..6bc4810daad93 100644 --- a/tests/ui/async-await/issue-64130-1-sync.stderr +++ b/tests/ui/async-await/issue-64130-1-sync.stderr @@ -4,7 +4,11 @@ error: future cannot be shared between threads safely LL | is_sync(bar()); | ^^^^^ future returned by `bar` is not `Sync` | - = help: within `impl Future`, the trait `Sync` is not implemented for `Foo` +help: within `impl Future`, the trait `Sync` is not implemented for `Foo` + --> $DIR/issue-64130-1-sync.rs:7:1 + | +LL | struct Foo; + | ^^^^^^^^^^ note: future is not `Sync` as this value is used across an await --> $DIR/issue-64130-1-sync.rs:15:11 | diff --git a/tests/ui/async-await/issue-64130-2-send.stderr b/tests/ui/async-await/issue-64130-2-send.stderr index f05e954d2d714..99c249843b8aa 100644 --- a/tests/ui/async-await/issue-64130-2-send.stderr +++ b/tests/ui/async-await/issue-64130-2-send.stderr @@ -4,7 +4,11 @@ error: future cannot be sent between threads safely LL | is_send(bar()); | ^^^^^ future returned by `bar` is not `Send` | - = help: within `impl Future`, the trait `Send` is not implemented for `Foo` +help: within `impl Future`, the trait `Send` is not implemented for `Foo` + --> $DIR/issue-64130-2-send.rs:7:1 + | +LL | struct Foo; + | ^^^^^^^^^^ note: future is not `Send` as this value is used across an await --> $DIR/issue-64130-2-send.rs:15:11 | diff --git a/tests/ui/async-await/issue-64130-3-other.stderr b/tests/ui/async-await/issue-64130-3-other.stderr index 3ac30bdc23e63..d683366ed4737 100644 --- a/tests/ui/async-await/issue-64130-3-other.stderr +++ b/tests/ui/async-await/issue-64130-3-other.stderr @@ -5,8 +5,13 @@ LL | async fn bar() { | -------------- within this `impl Future` ... LL | is_qux(bar()); - | ^^^^^ within `impl Future`, the trait `Qux` is not implemented for `Foo` + | ^^^^^ unsatisfied trait bound | +help: within `impl Future`, the trait `Qux` is not implemented for `Foo` + --> $DIR/issue-64130-3-other.rs:10:1 + | +LL | struct Foo; + | ^^^^^^^^^^ note: future does not implement `Qux` as this value is used across an await --> $DIR/issue-64130-3-other.rs:18:11 | diff --git a/tests/ui/async-await/partial-drop-partial-reinit.stderr b/tests/ui/async-await/partial-drop-partial-reinit.stderr index 042ed18984ee2..cef835f7aed8b 100644 --- a/tests/ui/async-await/partial-drop-partial-reinit.stderr +++ b/tests/ui/async-await/partial-drop-partial-reinit.stderr @@ -9,7 +9,11 @@ LL | gimme_send(foo()); LL | async fn foo() { | -------------- within this `impl Future` | - = help: within `impl Future`, the trait `Send` is not implemented for `NotSend` +help: within `impl Future`, the trait `Send` is not implemented for `NotSend` + --> $DIR/partial-drop-partial-reinit.rs:19:1 + | +LL | struct NotSend {} + | ^^^^^^^^^^^^^^ = note: required because it appears within the type `(NotSend,)` note: required because it's used within this `async` fn body --> $DIR/partial-drop-partial-reinit.rs:27:16 diff --git a/tests/ui/auto-traits/issue-83857-ub.stderr b/tests/ui/auto-traits/issue-83857-ub.stderr index 3536450c75b12..9bfdecf6f5449 100644 --- a/tests/ui/auto-traits/issue-83857-ub.stderr +++ b/tests/ui/auto-traits/issue-83857-ub.stderr @@ -4,7 +4,11 @@ error[E0277]: `Foo` cannot be sent between threads safely LL | fn generic(v: Foo, f: fn( as WithAssoc>::Output) -> i32) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `Foo` cannot be sent between threads safely | - = help: the trait `Send` is not implemented for `Foo` +help: the trait `Send` is not implemented for `Foo` + --> $DIR/issue-83857-ub.rs:6:1 + | +LL | struct Foo(Always); + | ^^^^^^^^^^^^^^^^ note: required for `Foo` to implement `WithAssoc` --> $DIR/issue-83857-ub.rs:14:15 | @@ -23,7 +27,11 @@ error[E0277]: `Foo` cannot be sent between threads safely LL | fn generic(v: Foo, f: fn( as WithAssoc>::Output) -> i32) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `Foo` cannot be sent between threads safely | - = help: the trait `Send` is not implemented for `Foo` +help: the trait `Send` is not implemented for `Foo` + --> $DIR/issue-83857-ub.rs:6:1 + | +LL | struct Foo(Always); + | ^^^^^^^^^^^^^^^^ note: required for `Foo` to implement `WithAssoc` --> $DIR/issue-83857-ub.rs:14:15 | @@ -44,7 +52,11 @@ LL | f(foo(v)); | | | required by a bound introduced by this call | - = help: the trait `Send` is not implemented for `Foo` +help: the trait `Send` is not implemented for `Foo` + --> $DIR/issue-83857-ub.rs:6:1 + | +LL | struct Foo(Always); + | ^^^^^^^^^^^^^^^^ note: required by a bound in `foo` --> $DIR/issue-83857-ub.rs:28:11 | diff --git a/tests/ui/auto-traits/typeck-default-trait-impl-constituent-types-2.stderr b/tests/ui/auto-traits/typeck-default-trait-impl-constituent-types-2.stderr index aa5585a5371f6..c948e1b10514a 100644 --- a/tests/ui/auto-traits/typeck-default-trait-impl-constituent-types-2.stderr +++ b/tests/ui/auto-traits/typeck-default-trait-impl-constituent-types-2.stderr @@ -2,8 +2,13 @@ error[E0277]: the trait bound `MyS2: MyTrait` is not satisfied in `(MyS2, MyS)` --> $DIR/typeck-default-trait-impl-constituent-types-2.rs:17:18 | LL | is_mytrait::<(MyS2, MyS)>(); - | ^^^^^^^^^^^ within `(MyS2, MyS)`, the trait `MyTrait` is not implemented for `MyS2` + | ^^^^^^^^^^^ unsatisfied trait bound | +help: within `(MyS2, MyS)`, the trait `MyTrait` is not implemented for `MyS2` + --> $DIR/typeck-default-trait-impl-constituent-types-2.rs:8:1 + | +LL | struct MyS2; + | ^^^^^^^^^^^ = note: required because it appears within the type `(MyS2, MyS)` note: required by a bound in `is_mytrait` --> $DIR/typeck-default-trait-impl-constituent-types-2.rs:12:18 diff --git a/tests/ui/auto-traits/typeck-default-trait-impl-constituent-types.stderr b/tests/ui/auto-traits/typeck-default-trait-impl-constituent-types.stderr index 668cbc8aeb43e..ae33aeff6e2d4 100644 --- a/tests/ui/auto-traits/typeck-default-trait-impl-constituent-types.stderr +++ b/tests/ui/auto-traits/typeck-default-trait-impl-constituent-types.stderr @@ -2,8 +2,13 @@ error[E0277]: the trait bound `MyS2: MyTrait` is not satisfied --> $DIR/typeck-default-trait-impl-constituent-types.rs:21:18 | LL | is_mytrait::(); - | ^^^^ the trait `MyTrait` is not implemented for `MyS2` + | ^^^^ unsatisfied trait bound | +help: the trait `MyTrait` is not implemented for `MyS2` + --> $DIR/typeck-default-trait-impl-constituent-types.rs:10:1 + | +LL | struct MyS2; + | ^^^^^^^^^^^ note: required by a bound in `is_mytrait` --> $DIR/typeck-default-trait-impl-constituent-types.rs:16:18 | diff --git a/tests/ui/auto-traits/typeck-default-trait-impl-negation.stderr b/tests/ui/auto-traits/typeck-default-trait-impl-negation.stderr index fa8dd41da237b..4b10262c2e2a0 100644 --- a/tests/ui/auto-traits/typeck-default-trait-impl-negation.stderr +++ b/tests/ui/auto-traits/typeck-default-trait-impl-negation.stderr @@ -2,8 +2,13 @@ error[E0277]: the trait bound `ThisImplsUnsafeTrait: MyTrait` is not satisfied --> $DIR/typeck-default-trait-impl-negation.rs:22:19 | LL | is_my_trait::(); - | ^^^^^^^^^^^^^^^^^^^^ the trait `MyTrait` is not implemented for `ThisImplsUnsafeTrait` + | ^^^^^^^^^^^^^^^^^^^^ unsatisfied trait bound | +help: the trait `MyTrait` is not implemented for `ThisImplsUnsafeTrait` + --> $DIR/typeck-default-trait-impl-negation.rs:13:1 + | +LL | struct ThisImplsUnsafeTrait; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: required by a bound in `is_my_trait` --> $DIR/typeck-default-trait-impl-negation.rs:17:19 | @@ -14,8 +19,13 @@ error[E0277]: the trait bound `ThisImplsTrait: MyUnsafeTrait` is not satisfied --> $DIR/typeck-default-trait-impl-negation.rs:25:26 | LL | is_my_unsafe_trait::(); - | ^^^^^^^^^^^^^^ the trait `MyUnsafeTrait` is not implemented for `ThisImplsTrait` + | ^^^^^^^^^^^^^^ unsatisfied trait bound + | +help: the trait `MyUnsafeTrait` is not implemented for `ThisImplsTrait` + --> $DIR/typeck-default-trait-impl-negation.rs:8:1 | +LL | struct ThisImplsTrait; + | ^^^^^^^^^^^^^^^^^^^^^ note: required by a bound in `is_my_unsafe_trait` --> $DIR/typeck-default-trait-impl-negation.rs:18:26 | diff --git a/tests/ui/coherence/fuzzing/best-obligation-ICE.stderr b/tests/ui/coherence/fuzzing/best-obligation-ICE.stderr index fe28f4ff13601..dedc895104162 100644 --- a/tests/ui/coherence/fuzzing/best-obligation-ICE.stderr +++ b/tests/ui/coherence/fuzzing/best-obligation-ICE.stderr @@ -11,8 +11,13 @@ error[E0277]: the trait bound `W>: Trait` is not satisfied --> $DIR/best-obligation-ICE.rs:10:19 | LL | impl Trait for W>> {} - | ^^^^^^^^^^ the trait `Trait` is not implemented for `W>` + | ^^^^^^^^^^ unsatisfied trait bound | +help: the trait `Trait` is not implemented for `W>` + --> $DIR/best-obligation-ICE.rs:9:1 + | +LL | struct W(*mut T); + | ^^^^^^^^^^^^^^^^^^ note: required by a bound in `W` --> $DIR/best-obligation-ICE.rs:9:13 | @@ -27,8 +32,13 @@ error[E0277]: the trait bound `W: Trait` is not satisfied --> $DIR/best-obligation-ICE.rs:10:19 | LL | impl Trait for W>> {} - | ^^^^^^^^^^ the trait `Trait` is not implemented for `W` + | ^^^^^^^^^^ unsatisfied trait bound | +help: the trait `Trait` is not implemented for `W` + --> $DIR/best-obligation-ICE.rs:9:1 + | +LL | struct W(*mut T); + | ^^^^^^^^^^^^^^^^^^ note: required by a bound in `W` --> $DIR/best-obligation-ICE.rs:9:13 | diff --git a/tests/ui/const-generics/adt_const_params/const_param_ty_bad_empty_array.stderr b/tests/ui/const-generics/adt_const_params/const_param_ty_bad_empty_array.stderr index 9220cd1f94e36..373ac9435daf1 100644 --- a/tests/ui/const-generics/adt_const_params/const_param_ty_bad_empty_array.stderr +++ b/tests/ui/const-generics/adt_const_params/const_param_ty_bad_empty_array.stderr @@ -2,8 +2,13 @@ error[E0277]: `NotParam` can't be used as a const parameter type --> $DIR/const_param_ty_bad_empty_array.rs:10:13 | LL | check::<[NotParam; 0]>(); - | ^^^^^^^^^^^^^ the trait `ConstParamTy_` is not implemented for `NotParam` + | ^^^^^^^^^^^^^ unsatisfied trait bound | +help: the trait `ConstParamTy_` is not implemented for `NotParam` + --> $DIR/const_param_ty_bad_empty_array.rs:5:1 + | +LL | struct NotParam; + | ^^^^^^^^^^^^^^^ = note: required for `[NotParam; 0]` to implement `ConstParamTy_` note: required by a bound in `check` --> $DIR/const_param_ty_bad_empty_array.rs:7:13 diff --git a/tests/ui/const-generics/adt_const_params/const_param_ty_generic_bounds_do_not_hold.stderr b/tests/ui/const-generics/adt_const_params/const_param_ty_generic_bounds_do_not_hold.stderr index d01aaffe8aeba..158e76630f3a3 100644 --- a/tests/ui/const-generics/adt_const_params/const_param_ty_generic_bounds_do_not_hold.stderr +++ b/tests/ui/const-generics/adt_const_params/const_param_ty_generic_bounds_do_not_hold.stderr @@ -2,8 +2,13 @@ error[E0277]: `NotParam` can't be used as a const parameter type --> $DIR/const_param_ty_generic_bounds_do_not_hold.rs:10:13 | LL | check::<&NotParam>(); - | ^^^^^^^^^ the trait `UnsizedConstParamTy` is not implemented for `NotParam` + | ^^^^^^^^^ unsatisfied trait bound | +help: the trait `UnsizedConstParamTy` is not implemented for `NotParam` + --> $DIR/const_param_ty_generic_bounds_do_not_hold.rs:5:1 + | +LL | struct NotParam; + | ^^^^^^^^^^^^^^^ = note: required for `&NotParam` to implement `UnsizedConstParamTy` note: required by a bound in `check` --> $DIR/const_param_ty_generic_bounds_do_not_hold.rs:7:13 @@ -15,8 +20,13 @@ error[E0277]: `NotParam` can't be used as a const parameter type --> $DIR/const_param_ty_generic_bounds_do_not_hold.rs:11:13 | LL | check::<[NotParam]>(); - | ^^^^^^^^^^ the trait `UnsizedConstParamTy` is not implemented for `NotParam` + | ^^^^^^^^^^ unsatisfied trait bound + | +help: the trait `UnsizedConstParamTy` is not implemented for `NotParam` + --> $DIR/const_param_ty_generic_bounds_do_not_hold.rs:5:1 | +LL | struct NotParam; + | ^^^^^^^^^^^^^^^ = note: required for `[NotParam]` to implement `UnsizedConstParamTy` note: required by a bound in `check` --> $DIR/const_param_ty_generic_bounds_do_not_hold.rs:7:13 @@ -28,8 +38,13 @@ error[E0277]: `NotParam` can't be used as a const parameter type --> $DIR/const_param_ty_generic_bounds_do_not_hold.rs:12:13 | LL | check::<[NotParam; 17]>(); - | ^^^^^^^^^^^^^^ the trait `UnsizedConstParamTy` is not implemented for `NotParam` + | ^^^^^^^^^^^^^^ unsatisfied trait bound + | +help: the trait `UnsizedConstParamTy` is not implemented for `NotParam` + --> $DIR/const_param_ty_generic_bounds_do_not_hold.rs:5:1 | +LL | struct NotParam; + | ^^^^^^^^^^^^^^^ = note: required for `[NotParam; 17]` to implement `UnsizedConstParamTy` note: required by a bound in `check` --> $DIR/const_param_ty_generic_bounds_do_not_hold.rs:7:13 diff --git a/tests/ui/const-generics/adt_const_params/const_param_ty_impl_no_structural_eq.stderr b/tests/ui/const-generics/adt_const_params/const_param_ty_impl_no_structural_eq.stderr index b651cca3216b3..d3141381db8cf 100644 --- a/tests/ui/const-generics/adt_const_params/const_param_ty_impl_no_structural_eq.stderr +++ b/tests/ui/const-generics/adt_const_params/const_param_ty_impl_no_structural_eq.stderr @@ -16,8 +16,13 @@ error[E0277]: the type `CantParam` does not `#[derive(PartialEq)]` --> $DIR/const_param_ty_impl_no_structural_eq.rs:10:43 | LL | impl std::marker::UnsizedConstParamTy for CantParam {} - | ^^^^^^^^^ the trait `StructuralPartialEq` is not implemented for `CantParam` + | ^^^^^^^^^ unsatisfied trait bound | +help: the trait `StructuralPartialEq` is not implemented for `CantParam` + --> $DIR/const_param_ty_impl_no_structural_eq.rs:8:1 + | +LL | struct CantParam(ImplementsConstParamTy); + | ^^^^^^^^^^^^^^^^ note: required by a bound in `UnsizedConstParamTy` --> $SRC_DIR/core/src/marker.rs:LL:COL @@ -39,8 +44,13 @@ error[E0277]: the type `CantParamDerive` does not `#[derive(PartialEq)]` --> $DIR/const_param_ty_impl_no_structural_eq.rs:14:10 | LL | #[derive(std::marker::UnsizedConstParamTy)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `StructuralPartialEq` is not implemented for `CantParamDerive` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unsatisfied trait bound | +help: the trait `StructuralPartialEq` is not implemented for `CantParamDerive` + --> $DIR/const_param_ty_impl_no_structural_eq.rs:17:1 + | +LL | struct CantParamDerive(ImplementsConstParamTy); + | ^^^^^^^^^^^^^^^^^^^^^^ note: required by a bound in `UnsizedConstParamTy` --> $SRC_DIR/core/src/marker.rs:LL:COL diff --git a/tests/ui/const-generics/defaults/rp_impl_trait_fail.stderr b/tests/ui/const-generics/defaults/rp_impl_trait_fail.stderr index e36f645b2637b..65c480d7c494c 100644 --- a/tests/ui/const-generics/defaults/rp_impl_trait_fail.stderr +++ b/tests/ui/const-generics/defaults/rp_impl_trait_fail.stderr @@ -2,11 +2,16 @@ error[E0277]: the trait bound `Uwu<10, 12>: Trait` is not satisfied --> $DIR/rp_impl_trait_fail.rs:6:14 | LL | fn rawr() -> impl Trait { - | ^^^^^^^^^^ the trait `Trait` is not implemented for `Uwu<10, 12>` + | ^^^^^^^^^^ unsatisfied trait bound LL | LL | Uwu::<10, 12> | ------------- return type was inferred to be `Uwu<10, 12>` here | +help: the trait `Trait` is not implemented for `Uwu<10, 12>` + --> $DIR/rp_impl_trait_fail.rs:1:1 + | +LL | struct Uwu; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = help: the trait `Trait` is implemented for `Uwu` error[E0277]: the trait bound `u32: Traitor` is not satisfied diff --git a/tests/ui/const-generics/occurs-check/unused-substs-1.stderr b/tests/ui/const-generics/occurs-check/unused-substs-1.stderr index 07e86aa17f2d2..70fc71c99b912 100644 --- a/tests/ui/const-generics/occurs-check/unused-substs-1.stderr +++ b/tests/ui/const-generics/occurs-check/unused-substs-1.stderr @@ -2,7 +2,7 @@ error[E0277]: the trait bound `A<_>: Bar<_>` is not satisfied --> $DIR/unused-substs-1.rs:12:13 | LL | let _ = A; - | ^ the trait `Bar<_>` is not implemented for `A<_>` + | ^ unsatisfied trait bound | = help: the trait `Bar<_>` is not implemented for `A<_>` but it is implemented for `A<{ 6 + 1 }>` diff --git a/tests/ui/coroutine/drop-tracking-parent-expression.stderr b/tests/ui/coroutine/drop-tracking-parent-expression.stderr index 2f5fe882f6e77..fe8c17c12946d 100644 --- a/tests/ui/coroutine/drop-tracking-parent-expression.stderr +++ b/tests/ui/coroutine/drop-tracking-parent-expression.stderr @@ -12,7 +12,11 @@ LL | | }; LL | | ); | |_____- in this macro invocation | - = help: within `{coroutine@$DIR/drop-tracking-parent-expression.rs:19:34: 19:41}`, the trait `Send` is not implemented for `derived_drop::Client` +help: within `{coroutine@$DIR/drop-tracking-parent-expression.rs:19:34: 19:41}`, the trait `Send` is not implemented for `derived_drop::Client` + --> $DIR/drop-tracking-parent-expression.rs:51:46 + | +LL | derived_drop => { #[derive(Default)] pub struct Client { pub nickname: String } }; + | ^^^^^^^^^^^^^^^^^ note: coroutine is not `Send` as this value is used across a yield --> $DIR/drop-tracking-parent-expression.rs:23:22 | @@ -50,7 +54,11 @@ LL | | }; LL | | ); | |_____- in this macro invocation | - = help: within `{coroutine@$DIR/drop-tracking-parent-expression.rs:19:34: 19:41}`, the trait `Send` is not implemented for `significant_drop::Client` +help: within `{coroutine@$DIR/drop-tracking-parent-expression.rs:19:34: 19:41}`, the trait `Send` is not implemented for `significant_drop::Client` + --> $DIR/drop-tracking-parent-expression.rs:55:13 + | +LL | pub struct Client; + | ^^^^^^^^^^^^^^^^^ note: coroutine is not `Send` as this value is used across a yield --> $DIR/drop-tracking-parent-expression.rs:23:22 | @@ -88,7 +96,11 @@ LL | | }; LL | | ); | |_____- in this macro invocation | - = help: within `{coroutine@$DIR/drop-tracking-parent-expression.rs:19:34: 19:41}`, the trait `Send` is not implemented for `insignificant_dtor::Client` +help: within `{coroutine@$DIR/drop-tracking-parent-expression.rs:19:34: 19:41}`, the trait `Send` is not implemented for `insignificant_dtor::Client` + --> $DIR/drop-tracking-parent-expression.rs:64:13 + | +LL | pub struct Client; + | ^^^^^^^^^^^^^^^^^ note: coroutine is not `Send` as this value is used across a yield --> $DIR/drop-tracking-parent-expression.rs:23:22 | diff --git a/tests/ui/coroutine/drop-yield-twice.stderr b/tests/ui/coroutine/drop-yield-twice.stderr index c5da35d973625..5ac2b471cb615 100644 --- a/tests/ui/coroutine/drop-yield-twice.stderr +++ b/tests/ui/coroutine/drop-yield-twice.stderr @@ -9,7 +9,11 @@ LL | | yield; LL | | }) | |______^ coroutine is not `Send` | - = help: within `{coroutine@$DIR/drop-yield-twice.rs:7:30: 7:32}`, the trait `Send` is not implemented for `Foo` +help: within `{coroutine@$DIR/drop-yield-twice.rs:7:30: 7:32}`, the trait `Send` is not implemented for `Foo` + --> $DIR/drop-yield-twice.rs:3:1 + | +LL | struct Foo(i32); + | ^^^^^^^^^^ note: coroutine is not `Send` as this value is used across a yield --> $DIR/drop-yield-twice.rs:9:9 | diff --git a/tests/ui/coroutine/not-send-sync.stderr b/tests/ui/coroutine/not-send-sync.stderr index c6d2ac0a5574b..16277edd66a8e 100644 --- a/tests/ui/coroutine/not-send-sync.stderr +++ b/tests/ui/coroutine/not-send-sync.stderr @@ -9,7 +9,11 @@ LL | | drop(a); LL | | }); | |______^ coroutine is not `Sync` | - = help: within `{coroutine@$DIR/not-send-sync.rs:14:30: 14:32}`, the trait `Sync` is not implemented for `NotSync` +help: within `{coroutine@$DIR/not-send-sync.rs:14:30: 14:32}`, the trait `Sync` is not implemented for `NotSync` + --> $DIR/not-send-sync.rs:5:1 + | +LL | struct NotSync; + | ^^^^^^^^^^^^^^ note: coroutine is not `Sync` as this value is used across a yield --> $DIR/not-send-sync.rs:17:9 | @@ -34,7 +38,11 @@ LL | | drop(a); LL | | }); | |______^ coroutine is not `Send` | - = help: within `{coroutine@$DIR/not-send-sync.rs:21:30: 21:32}`, the trait `Send` is not implemented for `NotSend` +help: within `{coroutine@$DIR/not-send-sync.rs:21:30: 21:32}`, the trait `Send` is not implemented for `NotSend` + --> $DIR/not-send-sync.rs:4:1 + | +LL | struct NotSend; + | ^^^^^^^^^^^^^^ note: coroutine is not `Send` as this value is used across a yield --> $DIR/not-send-sync.rs:24:9 | diff --git a/tests/ui/coroutine/parent-expression.stderr b/tests/ui/coroutine/parent-expression.stderr index f14bf05ed0949..0dd97c538a87c 100644 --- a/tests/ui/coroutine/parent-expression.stderr +++ b/tests/ui/coroutine/parent-expression.stderr @@ -12,7 +12,11 @@ LL | | }; LL | | ); | |_____- in this macro invocation | - = help: within `{coroutine@$DIR/parent-expression.rs:19:34: 19:41}`, the trait `Send` is not implemented for `derived_drop::Client` +help: within `{coroutine@$DIR/parent-expression.rs:19:34: 19:41}`, the trait `Send` is not implemented for `derived_drop::Client` + --> $DIR/parent-expression.rs:51:46 + | +LL | derived_drop => { #[derive(Default)] pub struct Client { pub nickname: String } }; + | ^^^^^^^^^^^^^^^^^ note: coroutine is not `Send` as this value is used across a yield --> $DIR/parent-expression.rs:23:22 | @@ -50,7 +54,11 @@ LL | | }; LL | | ); | |_____- in this macro invocation | - = help: within `{coroutine@$DIR/parent-expression.rs:19:34: 19:41}`, the trait `Send` is not implemented for `significant_drop::Client` +help: within `{coroutine@$DIR/parent-expression.rs:19:34: 19:41}`, the trait `Send` is not implemented for `significant_drop::Client` + --> $DIR/parent-expression.rs:55:13 + | +LL | pub struct Client; + | ^^^^^^^^^^^^^^^^^ note: coroutine is not `Send` as this value is used across a yield --> $DIR/parent-expression.rs:23:22 | @@ -88,7 +96,11 @@ LL | | }; LL | | ); | |_____- in this macro invocation | - = help: within `{coroutine@$DIR/parent-expression.rs:19:34: 19:41}`, the trait `Send` is not implemented for `insignificant_dtor::Client` +help: within `{coroutine@$DIR/parent-expression.rs:19:34: 19:41}`, the trait `Send` is not implemented for `insignificant_dtor::Client` + --> $DIR/parent-expression.rs:64:13 + | +LL | pub struct Client; + | ^^^^^^^^^^^^^^^^^ note: coroutine is not `Send` as this value is used across a yield --> $DIR/parent-expression.rs:23:22 | diff --git a/tests/ui/coroutine/print/coroutine-print-verbose-2.stderr b/tests/ui/coroutine/print/coroutine-print-verbose-2.stderr index 11b78e3bcf892..d27660c67d9b1 100644 --- a/tests/ui/coroutine/print/coroutine-print-verbose-2.stderr +++ b/tests/ui/coroutine/print/coroutine-print-verbose-2.stderr @@ -9,7 +9,11 @@ LL | | drop(a); LL | | }); | |______^ coroutine is not `Sync` | - = help: within `{main::{closure#0} upvar_tys=() resume_ty=() yield_ty=() return_ty=()}`, the trait `Sync` is not implemented for `NotSync` +help: within `{main::{closure#0} upvar_tys=() resume_ty=() yield_ty=() return_ty=()}`, the trait `Sync` is not implemented for `NotSync` + --> $DIR/coroutine-print-verbose-2.rs:8:1 + | +LL | struct NotSync; + | ^^^^^^^^^^^^^^ note: coroutine is not `Sync` as this value is used across a yield --> $DIR/coroutine-print-verbose-2.rs:20:9 | @@ -34,7 +38,11 @@ LL | | drop(a); LL | | }); | |______^ coroutine is not `Send` | - = help: within `{main::{closure#1} upvar_tys=() resume_ty=() yield_ty=() return_ty=()}`, the trait `Send` is not implemented for `NotSend` +help: within `{main::{closure#1} upvar_tys=() resume_ty=() yield_ty=() return_ty=()}`, the trait `Send` is not implemented for `NotSend` + --> $DIR/coroutine-print-verbose-2.rs:7:1 + | +LL | struct NotSend; + | ^^^^^^^^^^^^^^ note: coroutine is not `Send` as this value is used across a yield --> $DIR/coroutine-print-verbose-2.rs:27:9 | diff --git a/tests/ui/delegation/explicit-paths.stderr b/tests/ui/delegation/explicit-paths.stderr index 8098ea8c54f6c..29f87cf1457b1 100644 --- a/tests/ui/delegation/explicit-paths.stderr +++ b/tests/ui/delegation/explicit-paths.stderr @@ -89,8 +89,13 @@ error[E0277]: the trait bound `S2: Trait` is not satisfied --> $DIR/explicit-paths.rs:76:16 | LL | reuse ::foo1; - | ^^ the trait `Trait` is not implemented for `S2` + | ^^ unsatisfied trait bound | +help: the trait `Trait` is not implemented for `S2` + --> $DIR/explicit-paths.rs:73:5 + | +LL | struct S2; + | ^^^^^^^^^ = help: the following other types implement trait `Trait`: F S diff --git a/tests/ui/delegation/generics/impl-to-trait-method.stderr b/tests/ui/delegation/generics/impl-to-trait-method.stderr index aeba30de043f5..2c0b466dba3c9 100644 --- a/tests/ui/delegation/generics/impl-to-trait-method.stderr +++ b/tests/ui/delegation/generics/impl-to-trait-method.stderr @@ -2,8 +2,13 @@ error[E0277]: the trait bound `bounds::S: Trait0` is not satisfied --> $DIR/impl-to-trait-method.rs:12:19 | LL | Self: Trait0, - | ^^^^^^ the trait `Trait0` is not implemented for `bounds::S` + | ^^^^^^ unsatisfied trait bound | +help: the trait `Trait0` is not implemented for `bounds::S` + --> $DIR/impl-to-trait-method.rs:21:5 + | +LL | struct S(F); + | ^^^^^^^^ help: this trait has no implementations, consider adding one --> $DIR/impl-to-trait-method.rs:5:5 | @@ -19,10 +24,15 @@ error[E0277]: the trait bound `bounds::F: Trait0` is not satisfied --> $DIR/impl-to-trait-method.rs:24:34 | LL | reuse Trait1::::foo { &self.0 } - | --- ^^^^^^^ the trait `Trait0` is not implemented for `bounds::F` + | --- ^^^^^^^ unsatisfied trait bound | | | required by a bound introduced by this call | +help: the trait `Trait0` is not implemented for `bounds::F` + --> $DIR/impl-to-trait-method.rs:18:5 + | +LL | struct F; + | ^^^^^^^^ help: this trait has no implementations, consider adding one --> $DIR/impl-to-trait-method.rs:5:5 | diff --git a/tests/ui/delegation/ice-issue-122550.stderr b/tests/ui/delegation/ice-issue-122550.stderr index 1a01bee3e1e27..01355c8ad921c 100644 --- a/tests/ui/delegation/ice-issue-122550.stderr +++ b/tests/ui/delegation/ice-issue-122550.stderr @@ -8,8 +8,13 @@ error[E0277]: the trait bound `S: Trait` is not satisfied --> $DIR/ice-issue-122550.rs:13:12 | LL | reuse ::description { &self.0 } - | ^ the trait `Trait` is not implemented for `S` + | ^ unsatisfied trait bound | +help: the trait `Trait` is not implemented for `S` + --> $DIR/ice-issue-122550.rs:10:1 + | +LL | struct S(F); + | ^^^^^^^^ help: this trait has no implementations, consider adding one --> $DIR/ice-issue-122550.rs:4:1 | diff --git a/tests/ui/did_you_mean/issue-21659-show-relevant-trait-impls-1.stderr b/tests/ui/did_you_mean/issue-21659-show-relevant-trait-impls-1.stderr index 9d335b391eb19..b754bafb34465 100644 --- a/tests/ui/did_you_mean/issue-21659-show-relevant-trait-impls-1.stderr +++ b/tests/ui/did_you_mean/issue-21659-show-relevant-trait-impls-1.stderr @@ -2,10 +2,15 @@ error[E0277]: the trait bound `Bar: Foo` is not satisfied --> $DIR/issue-21659-show-relevant-trait-impls-1.rs:24:12 | LL | f1.foo(1usize); - | --- ^^^^^^ the trait `Foo` is not implemented for `Bar` + | --- ^^^^^^ unsatisfied trait bound | | | required by a bound introduced by this call | +help: the trait `Foo` is not implemented for `Bar` + --> $DIR/issue-21659-show-relevant-trait-impls-1.rs:13:1 + | +LL | struct Bar; + | ^^^^^^^^^^ = help: the following other types implement trait `Foo`: `Bar` implements `Foo` `Bar` implements `Foo` diff --git a/tests/ui/did_you_mean/issue-21659-show-relevant-trait-impls-2.stderr b/tests/ui/did_you_mean/issue-21659-show-relevant-trait-impls-2.stderr index f9d7180796015..8d1c05e7b544c 100644 --- a/tests/ui/did_you_mean/issue-21659-show-relevant-trait-impls-2.stderr +++ b/tests/ui/did_you_mean/issue-21659-show-relevant-trait-impls-2.stderr @@ -2,10 +2,15 @@ error[E0277]: the trait bound `Bar: Foo` is not satisfied --> $DIR/issue-21659-show-relevant-trait-impls-2.rs:28:12 | LL | f1.foo(1usize); - | --- ^^^^^^ the trait `Foo` is not implemented for `Bar` + | --- ^^^^^^ unsatisfied trait bound | | | required by a bound introduced by this call | +help: the trait `Foo` is not implemented for `Bar` + --> $DIR/issue-21659-show-relevant-trait-impls-2.rs:13:1 + | +LL | struct Bar; + | ^^^^^^^^^^ = help: the following other types implement trait `Foo`: `Bar` implements `Foo` `Bar` implements `Foo` diff --git a/tests/ui/drop/dropck-normalize-errors.nll.stderr b/tests/ui/drop/dropck-normalize-errors.nll.stderr index b008daa51a33e..39ec4033eab2f 100644 --- a/tests/ui/drop/dropck-normalize-errors.nll.stderr +++ b/tests/ui/drop/dropck-normalize-errors.nll.stderr @@ -2,8 +2,13 @@ error[E0277]: the trait bound `NonImplementedStruct: NonImplementedTrait` is not --> $DIR/dropck-normalize-errors.rs:19:28 | LL | fn make_a_decoder<'a>() -> ADecoder<'a> { - | ^^^^^^^^^^^^ within `ADecoder<'a>`, the trait `NonImplementedTrait` is not implemented for `NonImplementedStruct` + | ^^^^^^^^^^^^ unsatisfied trait bound | +help: within `ADecoder<'a>`, the trait `NonImplementedTrait` is not implemented for `NonImplementedStruct` + --> $DIR/dropck-normalize-errors.rs:14:1 + | +LL | struct NonImplementedStruct; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: this trait has no implementations, consider adding one --> $DIR/dropck-normalize-errors.rs:11:1 | @@ -25,8 +30,13 @@ error[E0277]: the trait bound `NonImplementedStruct: NonImplementedTrait` is not --> $DIR/dropck-normalize-errors.rs:27:20 | LL | type Decoder = BDecoder; - | ^^^^^^^^ within `BDecoder`, the trait `NonImplementedTrait` is not implemented for `NonImplementedStruct` + | ^^^^^^^^ unsatisfied trait bound + | +help: within `BDecoder`, the trait `NonImplementedTrait` is not implemented for `NonImplementedStruct` + --> $DIR/dropck-normalize-errors.rs:14:1 | +LL | struct NonImplementedStruct; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: this trait has no implementations, consider adding one --> $DIR/dropck-normalize-errors.rs:11:1 | @@ -51,8 +61,13 @@ error[E0277]: the trait bound `NonImplementedStruct: NonImplementedTrait` is not --> $DIR/dropck-normalize-errors.rs:31:22 | LL | non_implemented: ::Assoc, - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `NonImplementedTrait` is not implemented for `NonImplementedStruct` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unsatisfied trait bound | +help: the trait `NonImplementedTrait` is not implemented for `NonImplementedStruct` + --> $DIR/dropck-normalize-errors.rs:14:1 + | +LL | struct NonImplementedStruct; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: this trait has no implementations, consider adding one --> $DIR/dropck-normalize-errors.rs:11:1 | @@ -63,8 +78,13 @@ error[E0277]: the trait bound `NonImplementedStruct: NonImplementedTrait` is not --> $DIR/dropck-normalize-errors.rs:19:28 | LL | fn make_a_decoder<'a>() -> ADecoder<'a> { - | ^^^^^^^^^^^^ the trait `NonImplementedTrait` is not implemented for `NonImplementedStruct` + | ^^^^^^^^^^^^ unsatisfied trait bound + | +help: the trait `NonImplementedTrait` is not implemented for `NonImplementedStruct` + --> $DIR/dropck-normalize-errors.rs:14:1 | +LL | struct NonImplementedStruct; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: this trait has no implementations, consider adding one --> $DIR/dropck-normalize-errors.rs:11:1 | diff --git a/tests/ui/drop/dropck-normalize-errors.polonius.stderr b/tests/ui/drop/dropck-normalize-errors.polonius.stderr index f8674b8e34a42..3d72801b34363 100644 --- a/tests/ui/drop/dropck-normalize-errors.polonius.stderr +++ b/tests/ui/drop/dropck-normalize-errors.polonius.stderr @@ -2,8 +2,13 @@ error[E0277]: the trait bound `NonImplementedStruct: NonImplementedTrait` is not --> $DIR/dropck-normalize-errors.rs:19:28 | LL | fn make_a_decoder<'a>() -> ADecoder<'a> { - | ^^^^^^^^^^^^ within `ADecoder<'a>`, the trait `NonImplementedTrait` is not implemented for `NonImplementedStruct` + | ^^^^^^^^^^^^ unsatisfied trait bound | +help: within `ADecoder<'a>`, the trait `NonImplementedTrait` is not implemented for `NonImplementedStruct` + --> $DIR/dropck-normalize-errors.rs:14:1 + | +LL | struct NonImplementedStruct; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: this trait has no implementations, consider adding one --> $DIR/dropck-normalize-errors.rs:11:1 | @@ -25,8 +30,13 @@ error[E0277]: the trait bound `NonImplementedStruct: NonImplementedTrait` is not --> $DIR/dropck-normalize-errors.rs:27:20 | LL | type Decoder = BDecoder; - | ^^^^^^^^ within `BDecoder`, the trait `NonImplementedTrait` is not implemented for `NonImplementedStruct` + | ^^^^^^^^ unsatisfied trait bound + | +help: within `BDecoder`, the trait `NonImplementedTrait` is not implemented for `NonImplementedStruct` + --> $DIR/dropck-normalize-errors.rs:14:1 | +LL | struct NonImplementedStruct; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: this trait has no implementations, consider adding one --> $DIR/dropck-normalize-errors.rs:11:1 | @@ -51,8 +61,13 @@ error[E0277]: the trait bound `NonImplementedStruct: NonImplementedTrait` is not --> $DIR/dropck-normalize-errors.rs:31:22 | LL | non_implemented: ::Assoc, - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `NonImplementedTrait` is not implemented for `NonImplementedStruct` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unsatisfied trait bound + | +help: the trait `NonImplementedTrait` is not implemented for `NonImplementedStruct` + --> $DIR/dropck-normalize-errors.rs:14:1 | +LL | struct NonImplementedStruct; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: this trait has no implementations, consider adding one --> $DIR/dropck-normalize-errors.rs:11:1 | diff --git a/tests/ui/dst/dst-bad-coerce1.stderr b/tests/ui/dst/dst-bad-coerce1.stderr index 68456b8642c7b..223bf9ce08aee 100644 --- a/tests/ui/dst/dst-bad-coerce1.stderr +++ b/tests/ui/dst/dst-bad-coerce1.stderr @@ -13,8 +13,13 @@ error[E0277]: the trait bound `Foo: Bar` is not satisfied --> $DIR/dst-bad-coerce1.rs:20:29 | LL | let f3: &Fat = f2; - | ^^ the trait `Bar` is not implemented for `Foo` + | ^^ unsatisfied trait bound | +help: the trait `Bar` is not implemented for `Foo` + --> $DIR/dst-bad-coerce1.rs:7:1 + | +LL | struct Foo; + | ^^^^^^^^^^ help: this trait has no implementations, consider adding one --> $DIR/dst-bad-coerce1.rs:8:1 | diff --git a/tests/ui/errors/remap-path-prefix-diagnostics.not-diag-in-deps.stderr b/tests/ui/errors/remap-path-prefix-diagnostics.not-diag-in-deps.stderr index 229bfbe59e50d..234e251b2ad8d 100644 --- a/tests/ui/errors/remap-path-prefix-diagnostics.not-diag-in-deps.stderr +++ b/tests/ui/errors/remap-path-prefix-diagnostics.not-diag-in-deps.stderr @@ -2,8 +2,13 @@ error[E0277]: `A` doesn't implement `std::fmt::Display` --> remapped/errors/remap-path-prefix-diagnostics.rs:LL:COL | LL | impl r#trait::Trait for A {} - | ^ the trait `std::fmt::Display` is not implemented for `A` + | ^ unsatisfied trait bound | +help: the trait `std::fmt::Display` is not implemented for `A` + --> remapped/errors/remap-path-prefix-diagnostics.rs:LL:COL + | +LL | struct A; + | ^^^^^^^^ note: required by a bound in `Trait` --> $DIR/auxiliary/trait.rs:LL:COL | diff --git a/tests/ui/errors/remap-path-prefix-diagnostics.only-debuginfo-in-deps.stderr b/tests/ui/errors/remap-path-prefix-diagnostics.only-debuginfo-in-deps.stderr index a59af3b6a8263..3b0d66e75e86e 100644 --- a/tests/ui/errors/remap-path-prefix-diagnostics.only-debuginfo-in-deps.stderr +++ b/tests/ui/errors/remap-path-prefix-diagnostics.only-debuginfo-in-deps.stderr @@ -2,8 +2,13 @@ error[E0277]: `A` doesn't implement `std::fmt::Display` --> $DIR/remap-path-prefix-diagnostics.rs:LL:COL | LL | impl r#trait::Trait for A {} - | ^ the trait `std::fmt::Display` is not implemented for `A` + | ^ unsatisfied trait bound | +help: the trait `std::fmt::Display` is not implemented for `A` + --> $DIR/remap-path-prefix-diagnostics.rs:LL:COL + | +LL | struct A; + | ^^^^^^^^ note: required by a bound in `Trait` --> $DIR/auxiliary/trait-debuginfo.rs:LL:COL | diff --git a/tests/ui/errors/remap-path-prefix-diagnostics.only-diag-in-deps.stderr b/tests/ui/errors/remap-path-prefix-diagnostics.only-diag-in-deps.stderr index 18fb9afcf390a..e77c0e5f68d65 100644 --- a/tests/ui/errors/remap-path-prefix-diagnostics.only-diag-in-deps.stderr +++ b/tests/ui/errors/remap-path-prefix-diagnostics.only-diag-in-deps.stderr @@ -2,8 +2,13 @@ error[E0277]: `A` doesn't implement `std::fmt::Display` --> $DIR/remap-path-prefix-diagnostics.rs:LL:COL | LL | impl r#trait::Trait for A {} - | ^ the trait `std::fmt::Display` is not implemented for `A` + | ^ unsatisfied trait bound | +help: the trait `std::fmt::Display` is not implemented for `A` + --> $DIR/remap-path-prefix-diagnostics.rs:LL:COL + | +LL | struct A; + | ^^^^^^^^ note: required by a bound in `Trait` --> $DIR/auxiliary/trait-diag.rs:LL:COL | diff --git a/tests/ui/errors/remap-path-prefix-diagnostics.only-macro-in-deps.stderr b/tests/ui/errors/remap-path-prefix-diagnostics.only-macro-in-deps.stderr index 9e770f07fba2f..91c9cd90152bf 100644 --- a/tests/ui/errors/remap-path-prefix-diagnostics.only-macro-in-deps.stderr +++ b/tests/ui/errors/remap-path-prefix-diagnostics.only-macro-in-deps.stderr @@ -2,8 +2,13 @@ error[E0277]: `A` doesn't implement `std::fmt::Display` --> $DIR/remap-path-prefix-diagnostics.rs:LL:COL | LL | impl r#trait::Trait for A {} - | ^ the trait `std::fmt::Display` is not implemented for `A` + | ^ unsatisfied trait bound | +help: the trait `std::fmt::Display` is not implemented for `A` + --> $DIR/remap-path-prefix-diagnostics.rs:LL:COL + | +LL | struct A; + | ^^^^^^^^ note: required by a bound in `Trait` --> $DIR/auxiliary/trait-macro.rs:LL:COL | diff --git a/tests/ui/errors/remap-path-prefix-diagnostics.with-debuginfo-in-deps.stderr b/tests/ui/errors/remap-path-prefix-diagnostics.with-debuginfo-in-deps.stderr index a59af3b6a8263..3b0d66e75e86e 100644 --- a/tests/ui/errors/remap-path-prefix-diagnostics.with-debuginfo-in-deps.stderr +++ b/tests/ui/errors/remap-path-prefix-diagnostics.with-debuginfo-in-deps.stderr @@ -2,8 +2,13 @@ error[E0277]: `A` doesn't implement `std::fmt::Display` --> $DIR/remap-path-prefix-diagnostics.rs:LL:COL | LL | impl r#trait::Trait for A {} - | ^ the trait `std::fmt::Display` is not implemented for `A` + | ^ unsatisfied trait bound | +help: the trait `std::fmt::Display` is not implemented for `A` + --> $DIR/remap-path-prefix-diagnostics.rs:LL:COL + | +LL | struct A; + | ^^^^^^^^ note: required by a bound in `Trait` --> $DIR/auxiliary/trait-debuginfo.rs:LL:COL | diff --git a/tests/ui/errors/remap-path-prefix-diagnostics.with-diag-in-deps.stderr b/tests/ui/errors/remap-path-prefix-diagnostics.with-diag-in-deps.stderr index ca6f2b1697a8a..00a647df61f9f 100644 --- a/tests/ui/errors/remap-path-prefix-diagnostics.with-diag-in-deps.stderr +++ b/tests/ui/errors/remap-path-prefix-diagnostics.with-diag-in-deps.stderr @@ -2,8 +2,13 @@ error[E0277]: `A` doesn't implement `std::fmt::Display` --> remapped/errors/remap-path-prefix-diagnostics.rs:LL:COL | LL | impl r#trait::Trait for A {} - | ^ the trait `std::fmt::Display` is not implemented for `A` + | ^ unsatisfied trait bound | +help: the trait `std::fmt::Display` is not implemented for `A` + --> remapped/errors/remap-path-prefix-diagnostics.rs:LL:COL + | +LL | struct A; + | ^^^^^^^^ note: required by a bound in `Trait` --> remapped/errors/auxiliary/trait-diag.rs:LL:COL | diff --git a/tests/ui/errors/remap-path-prefix-diagnostics.with-macro-in-deps.stderr b/tests/ui/errors/remap-path-prefix-diagnostics.with-macro-in-deps.stderr index 9e770f07fba2f..91c9cd90152bf 100644 --- a/tests/ui/errors/remap-path-prefix-diagnostics.with-macro-in-deps.stderr +++ b/tests/ui/errors/remap-path-prefix-diagnostics.with-macro-in-deps.stderr @@ -2,8 +2,13 @@ error[E0277]: `A` doesn't implement `std::fmt::Display` --> $DIR/remap-path-prefix-diagnostics.rs:LL:COL | LL | impl r#trait::Trait for A {} - | ^ the trait `std::fmt::Display` is not implemented for `A` + | ^ unsatisfied trait bound | +help: the trait `std::fmt::Display` is not implemented for `A` + --> $DIR/remap-path-prefix-diagnostics.rs:LL:COL + | +LL | struct A; + | ^^^^^^^^ note: required by a bound in `Trait` --> $DIR/auxiliary/trait-macro.rs:LL:COL | diff --git a/tests/ui/feature-gates/feature-gate-unboxed-closures-manual-impls.stderr b/tests/ui/feature-gates/feature-gate-unboxed-closures-manual-impls.stderr index 334bc63b7ee8c..b2a2eba9ad1da 100644 --- a/tests/ui/feature-gates/feature-gate-unboxed-closures-manual-impls.stderr +++ b/tests/ui/feature-gates/feature-gate-unboxed-closures-manual-impls.stderr @@ -93,7 +93,11 @@ error[E0277]: expected a `FnMut()` closure, found `Foo` LL | impl Fn<()> for Foo { | ^^^ expected an `FnMut()` closure, found `Foo` | - = help: the trait `FnMut()` is not implemented for `Foo` +help: the trait `FnMut()` is not implemented for `Foo` + --> $DIR/feature-gate-unboxed-closures-manual-impls.rs:8:1 + | +LL | struct Foo; + | ^^^^^^^^^^ = note: wrap the `Foo` in a closure with no arguments: `|| { /* code */ }` note: required by a bound in `Fn` --> $SRC_DIR/core/src/ops/function.rs:LL:COL @@ -163,7 +167,11 @@ error[E0277]: expected a `FnOnce()` closure, found `Bar` LL | impl FnMut<()> for Bar { | ^^^ expected an `FnOnce()` closure, found `Bar` | - = help: the trait `FnOnce()` is not implemented for `Bar` +help: the trait `FnOnce()` is not implemented for `Bar` + --> $DIR/feature-gate-unboxed-closures-manual-impls.rs:25:1 + | +LL | struct Bar; + | ^^^^^^^^^^ = note: wrap the `Bar` in a closure with no arguments: `|| { /* code */ }` note: required by a bound in `FnMut` --> $SRC_DIR/core/src/ops/function.rs:LL:COL diff --git a/tests/ui/fmt/non-source-literals.stderr b/tests/ui/fmt/non-source-literals.stderr index 5f8a6200dab7d..5f042e1e631ae 100644 --- a/tests/ui/fmt/non-source-literals.stderr +++ b/tests/ui/fmt/non-source-literals.stderr @@ -4,7 +4,11 @@ error[E0277]: `NonDisplay` doesn't implement `std::fmt::Display` LL | let _ = format!(concat!("{", "}"), NonDisplay); | ^^^^^^^^^^ `NonDisplay` cannot be formatted with the default formatter | - = help: the trait `std::fmt::Display` is not implemented for `NonDisplay` +help: the trait `std::fmt::Display` is not implemented for `NonDisplay` + --> $DIR/non-source-literals.rs:5:1 + | +LL | pub struct NonDisplay; + | ^^^^^^^^^^^^^^^^^^^^^ = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead = note: this error originates in the macro `$crate::__export::format_args` which comes from the expansion of the macro `format` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -14,7 +18,11 @@ error[E0277]: `NonDisplay` doesn't implement `std::fmt::Display` LL | let _ = format!(concat!("{", "0", "}"), NonDisplay); | ^^^^^^^^^^ `NonDisplay` cannot be formatted with the default formatter | - = help: the trait `std::fmt::Display` is not implemented for `NonDisplay` +help: the trait `std::fmt::Display` is not implemented for `NonDisplay` + --> $DIR/non-source-literals.rs:5:1 + | +LL | pub struct NonDisplay; + | ^^^^^^^^^^^^^^^^^^^^^ = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead = note: this error originates in the macro `$crate::__export::format_args` which comes from the expansion of the macro `format` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/fn/issue-39259.stderr b/tests/ui/fn/issue-39259.stderr index 90e305ca17a0e..fc5c828250353 100644 --- a/tests/ui/fn/issue-39259.stderr +++ b/tests/ui/fn/issue-39259.stderr @@ -24,7 +24,11 @@ error[E0277]: expected a `FnMut(u32)` closure, found `S` LL | impl Fn(u32) -> u32 for S { | ^ expected an `FnMut(u32)` closure, found `S` | - = help: the trait `FnMut(u32)` is not implemented for `S` +help: the trait `FnMut(u32)` is not implemented for `S` + --> $DIR/issue-39259.rs:4:1 + | +LL | struct S; + | ^^^^^^^^ note: required by a bound in `Fn` --> $SRC_DIR/core/src/ops/function.rs:LL:COL diff --git a/tests/ui/for/for-loop-bogosity.stderr b/tests/ui/for/for-loop-bogosity.stderr index 194a2fa08ceab..f4d99671f8e0c 100644 --- a/tests/ui/for/for-loop-bogosity.stderr +++ b/tests/ui/for/for-loop-bogosity.stderr @@ -4,7 +4,11 @@ error[E0277]: `MyStruct` is not an iterator LL | for x in bogus { | ^^^^^ `MyStruct` is not an iterator | - = help: the trait `Iterator` is not implemented for `MyStruct` +help: the trait `Iterator` is not implemented for `MyStruct` + --> $DIR/for-loop-bogosity.rs:1:1 + | +LL | struct MyStruct { + | ^^^^^^^^^^^^^^^ = note: required for `MyStruct` to implement `IntoIterator` error: aborting due to 1 previous error diff --git a/tests/ui/impl-trait/diagnostics/highlight-difference-between-expected-trait-and-found-trait.svg b/tests/ui/impl-trait/diagnostics/highlight-difference-between-expected-trait-and-found-trait.svg index 9832e28e008b5..73acb072ac52a 100644 --- a/tests/ui/impl-trait/diagnostics/highlight-difference-between-expected-trait-and-found-trait.svg +++ b/tests/ui/impl-trait/diagnostics/highlight-difference-between-expected-trait-and-found-trait.svg @@ -1,4 +1,4 @@ - +