rust/tests/ui/associated-types/hr-associated-type-projecti...

42 lines
1.7 KiB
Plaintext

error[E0271]: type mismatch resolving `<T as Deref>::Target == T`
--> $DIR/hr-associated-type-projection-1.rs:14:17
|
LL | impl<T: Copy + std::ops::Deref> UnsafeCopy<'_, T> for T {
| - expected this type parameter
LL | type Item = T;
| ^ expected type parameter `T`, found associated type
|
= note: expected type parameter `T`
found associated type `<T as Deref>::Target`
note: required by a bound in `UnsafeCopy`
--> $DIR/hr-associated-type-projection-1.rs:3:64
|
LL | trait UnsafeCopy<'a, T: Copy>
| ---------- required by a bound in this trait
LL | where
LL | for<'b> <Self as UnsafeCopy<'b, T>>::Item: std::ops::Deref<Target = T>,
| ^^^^^^^^^^ required by this bound in `UnsafeCopy`
help: consider further restricting this bound
|
LL | impl<T: Copy + std::ops::Deref<Target = T>> UnsafeCopy<'_, T> for T {
| ++++++++++++
error[E0271]: type mismatch resolving `<&str as Deref>::Target == &str`
--> $DIR/hr-associated-type-projection-1.rs:19:6
|
LL | <&'static str>::bug(&"");
| ^^^^^^^^^^^^ expected `&str`, found `str`
|
note: required by a bound in `UnsafeCopy::bug`
--> $DIR/hr-associated-type-projection-1.rs:3:64
|
LL | for<'b> <Self as UnsafeCopy<'b, T>>::Item: std::ops::Deref<Target = T>,
| ^^^^^^^^^^ required by this bound in `UnsafeCopy::bug`
...
LL | fn bug(item: &Self::Item) -> () {
| --- required by a bound in this associated function
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0271`.