diff --git a/src/librustc_trait_selection/traits/wf.rs b/src/librustc_trait_selection/traits/wf.rs index 63a6720b97d..d341909ef7f 100644 --- a/src/librustc_trait_selection/traits/wf.rs +++ b/src/librustc_trait_selection/traits/wf.rs @@ -8,6 +8,7 @@ use rustc_middle::ty::subst::{GenericArgKind, SubstsRef}; use rustc_middle::ty::{self, ToPredicate, Ty, TyCtxt, TypeFoldable, WithConstness}; use rustc_span::symbol::{kw, Ident}; use rustc_span::Span; +use std::rc::Rc; /// Returns the set of obligations needed to make `ty` well-formed. /// If `ty` contains unresolved inference variables, this may include @@ -315,6 +316,15 @@ impl<'a, 'tcx> WfPredicates<'a, 'tcx> { let implied_obligations = traits::util::elaborate_obligations(tcx, obligations.clone()); let implied_obligations = implied_obligations.map(|obligation| { let mut cause = cause.clone(); + let parent_trait_ref = obligation + .predicate + .to_opt_poly_trait_ref() + .unwrap_or_else(|| ty::Binder::dummy(*trait_ref)); + let derived_cause = traits::DerivedObligationCause { + parent_trait_ref, + parent_code: Rc::new(obligation.cause.code.clone()), + }; + cause.code = traits::ObligationCauseCode::ImplDerivedObligation(derived_cause); extend_cause_with_original_assoc_item_obligation( tcx, trait_ref, diff --git a/src/test/ui/associated-type-bounds/bad-bounds-on-assoc-in-trait.stderr b/src/test/ui/associated-type-bounds/bad-bounds-on-assoc-in-trait.stderr index d5066e39ebc..dd2f30e6dc0 100644 --- a/src/test/ui/associated-type-bounds/bad-bounds-on-assoc-in-trait.stderr +++ b/src/test/ui/associated-type-bounds/bad-bounds-on-assoc-in-trait.stderr @@ -1,10 +1,17 @@ error[E0277]: `>::App` doesn't implement `std::fmt::Debug` --> $DIR/bad-bounds-on-assoc-in-trait.rs:31:6 | +LL | trait Case1 { + | ----- +... +LL | Debug + | ----- required by this bound in `Case1` +... LL | impl Case1 for S1 { | ^^^^^ `>::App` cannot be formatted using `{:?}` because it doesn't implement `std::fmt::Debug` | = help: the trait `for<'a> std::fmt::Debug` is not implemented for `>::App` + = note: required because of the requirements on the impl of `for<'a> std::fmt::Debug` for `<<<::C as std::iter::Iterator>::Item as std::iter::Iterator>::Item as Lam<&'a u8>>::App` error[E0277]: `<::C as std::iter::Iterator>::Item` is not an iterator --> $DIR/bad-bounds-on-assoc-in-trait.rs:36:20 diff --git a/src/test/ui/associated-types/defaults-unsound-62211-1.stderr b/src/test/ui/associated-types/defaults-unsound-62211-1.stderr index cfca7cc1011..c4ab7b6e26e 100644 --- a/src/test/ui/associated-types/defaults-unsound-62211-1.stderr +++ b/src/test/ui/associated-types/defaults-unsound-62211-1.stderr @@ -42,11 +42,18 @@ LL | + Display = Self; error[E0277]: `T` doesn't implement `std::fmt::Display` --> $DIR/defaults-unsound-62211-1.rs:41:9 | +LL | trait UncheckedCopy: Sized { + | ------------- +... +LL | + Display = Self; + | ------- required by this bound in `UncheckedCopy` +... LL | impl UncheckedCopy for T {} | ^^^^^^^^^^^^^ `T` cannot be formatted with the default formatter | = help: the trait `std::fmt::Display` is not implemented for `T` = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead + = note: required because of the requirements on the impl of `std::fmt::Display` for `::Output` help: consider restricting type parameter `T` | LL | impl UncheckedCopy for T {} @@ -55,9 +62,16 @@ LL | impl UncheckedCopy for T {} error[E0277]: the trait bound `T: std::ops::Deref` is not satisfied --> $DIR/defaults-unsound-62211-1.rs:41:9 | +LL | trait UncheckedCopy: Sized { + | ------------- +... +LL | + Deref + | ------------------- required by this bound in `UncheckedCopy` +... LL | impl UncheckedCopy for T {} | ^^^^^^^^^^^^^ the trait `std::ops::Deref` is not implemented for `T` | + = note: required because of the requirements on the impl of `std::ops::Deref` for `::Output` help: consider restricting type parameter `T` | LL | impl UncheckedCopy for T {} @@ -66,10 +80,17 @@ LL | impl UncheckedCopy for T {} error[E0277]: cannot add-assign `&'static str` to `T` --> $DIR/defaults-unsound-62211-1.rs:41:9 | +LL | trait UncheckedCopy: Sized { + | ------------- +... +LL | + AddAssign<&'static str> + | ----------------------- required by this bound in `UncheckedCopy` +... LL | impl UncheckedCopy for T {} | ^^^^^^^^^^^^^ no implementation for `T += &'static str` | = help: the trait `std::ops::AddAssign<&'static str>` is not implemented for `T` + = note: required because of the requirements on the impl of `std::ops::AddAssign<&'static str>` for `::Output` help: consider restricting type parameter `T` | LL | impl> UncheckedCopy for T {} @@ -78,9 +99,16 @@ LL | impl> UncheckedCopy for T {} error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied --> $DIR/defaults-unsound-62211-1.rs:41:9 | +LL | trait UncheckedCopy: Sized { + | ------------- +... +LL | type Output: Copy + | ---- required by this bound in `UncheckedCopy` +... LL | impl UncheckedCopy for T {} | ^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T` | + = note: required because of the requirements on the impl of `std::marker::Copy` for `::Output` help: consider restricting type parameter `T` | LL | impl UncheckedCopy for T {} diff --git a/src/test/ui/associated-types/defaults-unsound-62211-2.stderr b/src/test/ui/associated-types/defaults-unsound-62211-2.stderr index 1dcfbf538e4..c311a9f456e 100644 --- a/src/test/ui/associated-types/defaults-unsound-62211-2.stderr +++ b/src/test/ui/associated-types/defaults-unsound-62211-2.stderr @@ -42,11 +42,18 @@ LL | + Display = Self; error[E0277]: `T` doesn't implement `std::fmt::Display` --> $DIR/defaults-unsound-62211-2.rs:41:9 | +LL | trait UncheckedCopy: Sized { + | ------------- +... +LL | + Display = Self; + | ------- required by this bound in `UncheckedCopy` +... LL | impl UncheckedCopy for T {} | ^^^^^^^^^^^^^ `T` cannot be formatted with the default formatter | = help: the trait `std::fmt::Display` is not implemented for `T` = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead + = note: required because of the requirements on the impl of `std::fmt::Display` for `::Output` help: consider restricting type parameter `T` | LL | impl UncheckedCopy for T {} @@ -55,9 +62,16 @@ LL | impl UncheckedCopy for T {} error[E0277]: the trait bound `T: std::ops::Deref` is not satisfied --> $DIR/defaults-unsound-62211-2.rs:41:9 | +LL | trait UncheckedCopy: Sized { + | ------------- +... +LL | + Deref + | ------------------- required by this bound in `UncheckedCopy` +... LL | impl UncheckedCopy for T {} | ^^^^^^^^^^^^^ the trait `std::ops::Deref` is not implemented for `T` | + = note: required because of the requirements on the impl of `std::ops::Deref` for `::Output` help: consider restricting type parameter `T` | LL | impl UncheckedCopy for T {} @@ -66,10 +80,17 @@ LL | impl UncheckedCopy for T {} error[E0277]: cannot add-assign `&'static str` to `T` --> $DIR/defaults-unsound-62211-2.rs:41:9 | +LL | trait UncheckedCopy: Sized { + | ------------- +... +LL | + AddAssign<&'static str> + | ----------------------- required by this bound in `UncheckedCopy` +... LL | impl UncheckedCopy for T {} | ^^^^^^^^^^^^^ no implementation for `T += &'static str` | = help: the trait `std::ops::AddAssign<&'static str>` is not implemented for `T` + = note: required because of the requirements on the impl of `std::ops::AddAssign<&'static str>` for `::Output` help: consider restricting type parameter `T` | LL | impl> UncheckedCopy for T {} @@ -78,9 +99,16 @@ LL | impl> UncheckedCopy for T {} error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied --> $DIR/defaults-unsound-62211-2.rs:41:9 | +LL | trait UncheckedCopy: Sized { + | ------------- +... +LL | type Output: Copy + | ---- required by this bound in `UncheckedCopy` +... LL | impl UncheckedCopy for T {} | ^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T` | + = note: required because of the requirements on the impl of `std::marker::Copy` for `::Output` help: consider restricting type parameter `T` | LL | impl UncheckedCopy for T {} diff --git a/src/test/ui/associated-types/issue-43924.stderr b/src/test/ui/associated-types/issue-43924.stderr index 75a5b3f3551..38dd8b66a6e 100644 --- a/src/test/ui/associated-types/issue-43924.stderr +++ b/src/test/ui/associated-types/issue-43924.stderr @@ -9,14 +9,28 @@ LL | type Out: Default + ToString + ?Sized = dyn ToString; error[E0277]: the trait bound `(dyn std::string::ToString + 'static): std::default::Default` is not satisfied --> $DIR/issue-43924.rs:10:6 | +LL | trait Foo { + | --- +LL | type Out: Default + ToString + ?Sized = dyn ToString; + | ------- required by this bound in `Foo` +... LL | impl Foo for () {} | ^^^^^^^^ the trait `std::default::Default` is not implemented for `(dyn std::string::ToString + 'static)` + | + = note: required because of the requirements on the impl of `std::default::Default` for `<() as Foo>::Out` error[E0277]: the trait bound `(dyn std::string::ToString + 'static): std::default::Default` is not satisfied --> $DIR/issue-43924.rs:11:6 | +LL | trait Foo { + | --- +LL | type Out: Default + ToString + ?Sized = dyn ToString; + | ------- required by this bound in `Foo` +... LL | impl Foo for () {} | ^^^^^^^^ the trait `std::default::Default` is not implemented for `(dyn std::string::ToString + 'static)` + | + = note: required because of the requirements on the impl of `std::default::Default` for `<() as Foo>::Out` error: aborting due to 3 previous errors diff --git a/src/test/ui/associated-types/issue-65774-1.stderr b/src/test/ui/associated-types/issue-65774-1.stderr index 559136be705..ae3ebe811e2 100644 --- a/src/test/ui/associated-types/issue-65774-1.stderr +++ b/src/test/ui/associated-types/issue-65774-1.stderr @@ -9,8 +9,15 @@ LL | type MpuConfig: MyDisplay = T; error[E0277]: the trait bound `T: MyDisplay` is not satisfied --> $DIR/issue-65774-1.rs:16:6 | +LL | trait MPU { + | --- +LL | type MpuConfig: MyDisplay = T; + | --------- required by this bound in `MPU` +... LL | impl MPU for S { } | ^^^ the trait `MyDisplay` is not implemented for `T` + | + = note: required because of the requirements on the impl of `MyDisplay` for `::MpuConfig` error: aborting due to 2 previous errors diff --git a/src/test/ui/associated-types/issue-65774-2.stderr b/src/test/ui/associated-types/issue-65774-2.stderr index cb515964226..dadf229bd5d 100644 --- a/src/test/ui/associated-types/issue-65774-2.stderr +++ b/src/test/ui/associated-types/issue-65774-2.stderr @@ -9,8 +9,15 @@ LL | type MpuConfig: MyDisplay = T; error[E0277]: the trait bound `T: MyDisplay` is not satisfied --> $DIR/issue-65774-2.rs:16:6 | +LL | trait MPU { + | --- +LL | type MpuConfig: MyDisplay = T; + | --------- required by this bound in `MPU` +... LL | impl MPU for S { } | ^^^ the trait `MyDisplay` is not implemented for `T` + | + = note: required because of the requirements on the impl of `MyDisplay` for `::MpuConfig` error: aborting due to 2 previous errors diff --git a/src/test/ui/builtin-superkinds/builtin-superkinds-double-superkind.stderr b/src/test/ui/builtin-superkinds/builtin-superkinds-double-superkind.stderr index ea5215e458d..b1437a36692 100644 --- a/src/test/ui/builtin-superkinds/builtin-superkinds-double-superkind.stderr +++ b/src/test/ui/builtin-superkinds/builtin-superkinds-double-superkind.stderr @@ -1,11 +1,15 @@ error[E0277]: `T` cannot be sent between threads safely --> $DIR/builtin-superkinds-double-superkind.rs:6:24 | +LL | trait Foo : Send+Sync { } + | ---- required by this bound in `Foo` +LL | LL | impl Foo for (T,) { } | ^^^ `T` cannot be sent between threads safely | = help: within `(T,)`, the trait `std::marker::Send` is not implemented for `T` = note: required because it appears within the type `(T,)` + = note: required because of the requirements on the impl of `std::marker::Send` for `(T,)` help: consider further restricting this bound | LL | impl Foo for (T,) { } @@ -14,11 +18,15 @@ LL | impl Foo for (T,) { } error[E0277]: `T` cannot be shared between threads safely --> $DIR/builtin-superkinds-double-superkind.rs:9:16 | +LL | trait Foo : Send+Sync { } + | ---- required by this bound in `Foo` +... LL | impl Foo for (T,T) { } | ^^^ `T` cannot be shared between threads safely | = help: within `(T, T)`, the trait `std::marker::Sync` is not implemented for `T` = note: required because it appears within the type `(T, T)` + = note: required because of the requirements on the impl of `std::marker::Sync` for `(T, T)` help: consider further restricting this bound | LL | impl Foo for (T,T) { } diff --git a/src/test/ui/builtin-superkinds/builtin-superkinds-in-metadata.stderr b/src/test/ui/builtin-superkinds/builtin-superkinds-in-metadata.stderr index ba6595f68d5..8555c843a93 100644 --- a/src/test/ui/builtin-superkinds/builtin-superkinds-in-metadata.stderr +++ b/src/test/ui/builtin-superkinds/builtin-superkinds-in-metadata.stderr @@ -3,9 +3,15 @@ error[E0277]: `T` cannot be sent between threads safely | LL | impl RequiresRequiresShareAndSend for X { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `T` cannot be sent between threads safely + | + ::: $DIR/auxiliary/trait_superkinds_in_metadata.rs:7:58 + | +LL | pub trait RequiresRequiresShareAndSend : RequiresShare + Send { } + | ---- required by this bound in `trait_superkinds_in_metadata::RequiresRequiresShareAndSend` | = help: within `X`, the trait `std::marker::Send` is not implemented for `T` = note: required because it appears within the type `X` + = note: required because of the requirements on the impl of `std::marker::Send` for `X` help: consider further restricting this bound | LL | impl RequiresRequiresShareAndSend for X { } diff --git a/src/test/ui/builtin-superkinds/builtin-superkinds-simple.stderr b/src/test/ui/builtin-superkinds/builtin-superkinds-simple.stderr index a0ff64077c4..b4f22f2d68f 100644 --- a/src/test/ui/builtin-superkinds/builtin-superkinds-simple.stderr +++ b/src/test/ui/builtin-superkinds/builtin-superkinds-simple.stderr @@ -1,10 +1,14 @@ error[E0277]: `std::rc::Rc` cannot be sent between threads safely --> $DIR/builtin-superkinds-simple.rs:6:6 | +LL | trait Foo : Send { } + | ---- required by this bound in `Foo` +LL | LL | impl Foo for std::rc::Rc { } | ^^^ `std::rc::Rc` cannot be sent between threads safely | = help: the trait `std::marker::Send` is not implemented for `std::rc::Rc` + = note: required because of the requirements on the impl of `std::marker::Send` for `std::rc::Rc` error: aborting due to previous error diff --git a/src/test/ui/builtin-superkinds/builtin-superkinds-typaram-not-send.stderr b/src/test/ui/builtin-superkinds/builtin-superkinds-typaram-not-send.stderr index bef33d1fd05..1334997c3d9 100644 --- a/src/test/ui/builtin-superkinds/builtin-superkinds-typaram-not-send.stderr +++ b/src/test/ui/builtin-superkinds/builtin-superkinds-typaram-not-send.stderr @@ -1,10 +1,14 @@ error[E0277]: `T` cannot be sent between threads safely --> $DIR/builtin-superkinds-typaram-not-send.rs:5:24 | +LL | trait Foo : Send { } + | ---- required by this bound in `Foo` +LL | LL | impl Foo for T { } | ^^^ `T` cannot be sent between threads safely | = help: the trait `std::marker::Send` is not implemented for `T` + = note: required because of the requirements on the impl of `std::marker::Send` for `T` help: consider further restricting this bound | LL | impl Foo for T { } diff --git a/src/test/ui/dst/dst-sized-trait-param.stderr b/src/test/ui/dst/dst-sized-trait-param.stderr index 40dc9978f36..14c7d02c258 100644 --- a/src/test/ui/dst/dst-sized-trait-param.stderr +++ b/src/test/ui/dst/dst-sized-trait-param.stderr @@ -1,20 +1,28 @@ error[E0277]: the size for values of type `[isize]` cannot be known at compilation time --> $DIR/dst-sized-trait-param.rs:7:6 | +LL | trait Foo : Sized { fn take(self, x: &T) { } } // Note: T is sized + | - required by this bound in `Foo` +LL | LL | impl Foo<[isize]> for usize { } | ^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `[isize]` = note: to learn more, visit + = note: required because of the requirements on the impl of `std::marker::Sized` for `[isize]` error[E0277]: the size for values of type `[usize]` cannot be known at compilation time --> $DIR/dst-sized-trait-param.rs:10:6 | +LL | trait Foo : Sized { fn take(self, x: &T) { } } // Note: T is sized + | ----- required by this bound in `Foo` +... LL | impl Foo for [usize] { } | ^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `[usize]` = note: to learn more, visit + = note: required because of the requirements on the impl of `std::marker::Sized` for `[usize]` error: aborting due to 2 previous errors diff --git a/src/test/ui/generic-associated-types/construct_with_other_type.stderr b/src/test/ui/generic-associated-types/construct_with_other_type.stderr index bad746f7ef1..f27bc4d68d4 100644 --- a/src/test/ui/generic-associated-types/construct_with_other_type.stderr +++ b/src/test/ui/generic-associated-types/construct_with_other_type.stderr @@ -1,12 +1,19 @@ error[E0271]: type mismatch resolving `for<'a> <::Baa<'a> as std::ops::Deref>::Target == <::Quux<'a> as Foo>::Bar<'a, 'static>` --> $DIR/construct_with_other_type.rs:19:9 | +LL | trait Baz { + | --- +... +LL | type Baa<'a>: Deref as Foo>::Bar<'a, 'static>> where Self: 'a; + | -------------------------------------------------- required by this bound in `Baz` +... LL | impl Baz for T where T: Foo { | ^^^ expected type parameter `T`, found associated type | = note: expected associated type `::Bar<'_, 'static>` found associated type `<::Quux<'_> as Foo>::Bar<'_, 'static>` = note: you might be missing a type parameter or trait bound + = note: required because of the requirements on the impl of `Baz` for `T` error: aborting due to previous error diff --git a/src/test/ui/generics/issue-61631-default-type-param-can-reference-self-in-trait.stderr b/src/test/ui/generics/issue-61631-default-type-param-can-reference-self-in-trait.stderr index ea0664c48d4..3f06dfdccd8 100644 --- a/src/test/ui/generics/issue-61631-default-type-param-can-reference-self-in-trait.stderr +++ b/src/test/ui/generics/issue-61631-default-type-param-can-reference-self-in-trait.stderr @@ -1,11 +1,15 @@ error[E0277]: the size for values of type `[()]` cannot be known at compilation time --> $DIR/issue-61631-default-type-param-can-reference-self-in-trait.rs:19:6 | +LL | trait Tsized {} + | - required by this bound in `Tsized` +LL | LL | impl Tsized for () {} | ^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `[()]` = note: to learn more, visit + = note: required because of the requirements on the impl of `std::marker::Sized` for `[()]` error: aborting due to previous error diff --git a/src/test/ui/impl-bounds-checking.stderr b/src/test/ui/impl-bounds-checking.stderr index b52f3d6b839..6453508410e 100644 --- a/src/test/ui/impl-bounds-checking.stderr +++ b/src/test/ui/impl-bounds-checking.stderr @@ -1,8 +1,13 @@ error[E0277]: the trait bound `isize: Clone2` is not satisfied --> $DIR/impl-bounds-checking.rs:10:6 | +LL | trait Getter { + | ------ required by this bound in `Getter` +... LL | impl Getter for isize { | ^^^^^^^^^^^^^ the trait `Clone2` is not implemented for `isize` + | + = note: required because of the requirements on the impl of `Clone2` for `isize` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-10412.stderr b/src/test/ui/issues/issue-10412.stderr index 0793dd99b4d..9c50b4af9a9 100644 --- a/src/test/ui/issues/issue-10412.stderr +++ b/src/test/ui/issues/issue-10412.stderr @@ -49,11 +49,15 @@ LL | impl<'self> Serializable for &'self str { error[E0277]: the size for values of type `str` cannot be known at compilation time --> $DIR/issue-10412.rs:6:13 | +LL | trait Serializable<'self, T> { + | - required by this bound in `Serializable` +... LL | impl<'self> Serializable for &'self str { | ^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `str` = note: to learn more, visit + = note: required because of the requirements on the impl of `std::marker::Sized` for `str` error: aborting due to 9 previous errors diff --git a/src/test/ui/issues/issue-43784-supertrait.stderr b/src/test/ui/issues/issue-43784-supertrait.stderr index 2fb0583ee7d..86c0f8f597b 100644 --- a/src/test/ui/issues/issue-43784-supertrait.stderr +++ b/src/test/ui/issues/issue-43784-supertrait.stderr @@ -4,6 +4,7 @@ error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied LL | impl Complete for T {} | ^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T` | + = note: required because of the requirements on the impl of `std::marker::Copy` for `T` help: consider restricting type parameter `T` | LL | impl Complete for T {} diff --git a/src/test/ui/malformed/malformed-derive-entry.stderr b/src/test/ui/malformed/malformed-derive-entry.stderr index ddc75c905ac..74606b71bf1 100644 --- a/src/test/ui/malformed/malformed-derive-entry.stderr +++ b/src/test/ui/malformed/malformed-derive-entry.stderr @@ -21,7 +21,13 @@ error[E0277]: the trait bound `Test1: std::clone::Clone` is not satisfied | LL | #[derive(Copy(Bad))] | ^^^^ the trait `std::clone::Clone` is not implemented for `Test1` + | + ::: $SRC_DIR/libcore/marker.rs:LL:COL | +LL | pub trait Copy: Clone { + | ----- required by this bound in `std::marker::Copy` + | + = note: required because of the requirements on the impl of `std::clone::Clone` for `Test1` = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `Test2: std::clone::Clone` is not satisfied @@ -29,7 +35,13 @@ error[E0277]: the trait bound `Test2: std::clone::Clone` is not satisfied | LL | #[derive(Copy="bad")] | ^^^^ the trait `std::clone::Clone` is not implemented for `Test2` + | + ::: $SRC_DIR/libcore/marker.rs:LL:COL | +LL | pub trait Copy: Clone { + | ----- required by this bound in `std::marker::Copy` + | + = note: required because of the requirements on the impl of `std::clone::Clone` for `Test2` = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 5 previous errors diff --git a/src/test/ui/specialization/defaultimpl/specialization-wfcheck.stderr b/src/test/ui/specialization/defaultimpl/specialization-wfcheck.stderr index 4e4cad62475..91e45df8d3e 100644 --- a/src/test/ui/specialization/defaultimpl/specialization-wfcheck.stderr +++ b/src/test/ui/specialization/defaultimpl/specialization-wfcheck.stderr @@ -1,9 +1,13 @@ error[E0277]: the trait bound `U: std::cmp::Eq` is not satisfied --> $DIR/specialization-wfcheck.rs:7:17 | +LL | trait Foo<'a, T: Eq + 'a> { } + | -- required by this bound in `Foo` +LL | LL | default impl Foo<'static, U> for () {} | ^^^^^^^^^^^^^^^ the trait `std::cmp::Eq` is not implemented for `U` | + = note: required because of the requirements on the impl of `std::cmp::Eq` for `U` help: consider restricting type parameter `U` | LL | default impl Foo<'static, U> for () {} diff --git a/src/test/ui/traits/traits-assoc-type-in-supertrait-bad.stderr b/src/test/ui/traits/traits-assoc-type-in-supertrait-bad.stderr index 5d0fb6b44cb..441fa9f2792 100644 --- a/src/test/ui/traits/traits-assoc-type-in-supertrait-bad.stderr +++ b/src/test/ui/traits/traits-assoc-type-in-supertrait-bad.stderr @@ -1,8 +1,13 @@ error[E0271]: type mismatch resolving ` as std::iter::Iterator>::Item == u32` --> $DIR/traits-assoc-type-in-supertrait-bad.rs:11:6 | +LL | pub trait Foo: Iterator::Key> { + | ----------------------- required by this bound in `Foo` +... LL | impl Foo for IntoIter { | ^^^ expected `i32`, found `u32` + | + = note: required because of the requirements on the impl of `Foo` for `std::vec::IntoIter` error: aborting due to previous error diff --git a/src/test/ui/unsized/unsized-trait-impl-trait-arg.stderr b/src/test/ui/unsized/unsized-trait-impl-trait-arg.stderr index b37d9f9d536..502dd201058 100644 --- a/src/test/ui/unsized/unsized-trait-impl-trait-arg.stderr +++ b/src/test/ui/unsized/unsized-trait-impl-trait-arg.stderr @@ -1,6 +1,9 @@ error[E0277]: the size for values of type `X` cannot be known at compilation time --> $DIR/unsized-trait-impl-trait-arg.rs:8:17 | +LL | trait T2 { + | - required by this bound in `T2` +... LL | impl T2 for S4 { | - ^^^^^ doesn't have a size known at compile-time | | @@ -8,6 +11,7 @@ LL | impl T2 for S4 { | = help: the trait `std::marker::Sized` is not implemented for `X` = note: to learn more, visit + = note: required because of the requirements on the impl of `std::marker::Sized` for `X` error: aborting due to previous error diff --git a/src/test/ui/unsized7.stderr b/src/test/ui/unsized7.stderr index 0f71c5f6f8f..cd30c98f55d 100644 --- a/src/test/ui/unsized7.stderr +++ b/src/test/ui/unsized7.stderr @@ -1,6 +1,9 @@ error[E0277]: the size for values of type `X` cannot be known at compilation time --> $DIR/unsized7.rs:12:21 | +LL | trait T1 { + | - required by this bound in `T1` +... LL | impl T1 for S3 { | - ^^^^^ doesn't have a size known at compile-time | | @@ -8,6 +11,7 @@ LL | impl T1 for S3 { | = help: the trait `std::marker::Sized` is not implemented for `X` = note: to learn more, visit + = note: required because of the requirements on the impl of `std::marker::Sized` for `X` error: aborting due to previous error