}
fn fold_ty(&mut self, t: Ty<'tcx>) -> Ty<'tcx> {
- match t.sty {
+ match t.kind {
ty::Projection(proj_ty) => {
if let Some(default) = self.map.get(&proj_ty) {
default
//~^ ERROR mismatched types
//~| NOTE expected associated type, found `()`
//~| NOTE expected associated type `<Self as Tr>::A`
- //~| NOTE consider constraining
+ //~| NOTE consider constraining the associated type
//~| NOTE for more information, visit
}
}
//~^ ERROR mismatched types
//~| NOTE expected associated type, found `u8`
//~| NOTE expected associated type `<Self as AssocConst>::Ty`
- //~| NOTE consider constraining
+ //~| NOTE consider constraining the associated type
//~| NOTE for more information, visit
}
= note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html
error[E0308]: mismatched types
- --> $DIR/defaults-in-other-trait-items.rs:37:25
+ --> $DIR/defaults-in-other-trait-items.rs:39:25
|
LL | const C: Self::Ty = 0u8;
| ^^^ expected associated type, found `u8`
struct E<T>(T);
impl<T> Tr for E<T> {
+ default type Ty = bool;
default fn make() -> Self::Ty { panic!(); }
}
| -------- type in trait
...
LL | fn make() -> u8 { 0 }
- | ^^ expected associated type, found u8
+ | ^^ expected associated type, found `u8`
|
- = note: expected type `fn() -> <A<T> as Tr>::Ty`
- found type `fn() -> u8`
+ = note: expected fn pointer `fn() -> <A<T> as Tr>::Ty`
+ found fn pointer `fn() -> u8`
+ = note: consider constraining the associated type `<A<T> as Tr>::Ty` to `u8` or calling a method that returns `<A<T> as Tr>::Ty`
+ = note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html
error[E0053]: method `make` has an incompatible type for trait
--> $DIR/defaults-specialization.rs:36:18
| -------- type in trait
...
LL | fn make() -> bool { true }
- | ^^^^ expected associated type, found bool
+ | ^^^^ expected associated type, found `bool`
|
- = note: expected type `fn() -> <B<T> as Tr>::Ty`
- found type `fn() -> bool`
+ = note: expected fn pointer `fn() -> <B<T> as Tr>::Ty`
+ found fn pointer `fn() -> bool`
+ = note: consider constraining the associated type `<B<T> as Tr>::Ty` to `bool` or calling a method that returns `<B<T> as Tr>::Ty`
+ = note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html
error[E0308]: mismatched types
--> $DIR/defaults-specialization.rs:11:9
LL | fn make() -> Self::Ty {
| -------- expected `<Self as Tr>::Ty` because of return type
LL | 0u8
- | ^^^ expected associated type, found u8
+ | ^^^ expected associated type, found `u8`
|
- = note: expected type `<Self as Tr>::Ty`
- found type `u8`
+ = note: expected associated type `<Self as Tr>::Ty`
+ found type `u8`
+ = note: consider constraining the associated type `<Self as Tr>::Ty` to `u8` or calling a method that returns `<Self as Tr>::Ty`
+ = note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html
error[E0308]: mismatched types
--> $DIR/defaults-specialization.rs:27:29
|
LL | fn make() -> Self::Ty { 0u8 }
- | -------- ^^^ expected associated type, found u8
+ | -------- ^^^ expected associated type, found `u8`
| |
| expected `<A2<T> as Tr>::Ty` because of return type
|
- = note: expected type `<A2<T> as Tr>::Ty`
- found type `u8`
+ = note: expected associated type `<A2<T> as Tr>::Ty`
+ found type `u8`
+ = note: consider constraining the associated type `<A2<T> as Tr>::Ty` to `u8` or calling a method that returns `<A2<T> as Tr>::Ty`
+ = note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html
error[E0308]: mismatched types
--> $DIR/defaults-specialization.rs:45:29
|
LL | fn make() -> Self::Ty { true }
- | -------- ^^^^ expected associated type, found bool
+ | -------- ^^^^ expected associated type, found `bool`
| |
| expected `<B2<T> as Tr>::Ty` because of return type
|
- = note: expected type `<B2<T> as Tr>::Ty`
- found type `bool`
+ = note: expected associated type `<B2<T> as Tr>::Ty`
+ found type `bool`
+ = note: consider constraining the associated type `<B2<T> as Tr>::Ty` to `bool` or calling a method that returns `<B2<T> as Tr>::Ty`
+ = note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html
error[E0308]: mismatched types
- --> $DIR/defaults-specialization.rs:87:32
+ --> $DIR/defaults-specialization.rs:88:32
|
LL | let _: <B<()> as Tr>::Ty = 0u8;
- | ^^^ expected associated type, found u8
+ | ^^^ expected associated type, found `u8`
|
- = note: expected type `<B<()> as Tr>::Ty`
- found type `u8`
+ = note: expected associated type `<B<()> as Tr>::Ty`
+ found type `u8`
+ = note: consider constraining the associated type `<B<()> as Tr>::Ty` to `u8` or calling a method that returns `<B<()> as Tr>::Ty`
+ = note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html
error[E0308]: mismatched types
- --> $DIR/defaults-specialization.rs:88:32
+ --> $DIR/defaults-specialization.rs:89:32
|
LL | let _: <B<()> as Tr>::Ty = true;
- | ^^^^ expected associated type, found bool
+ | ^^^^ expected associated type, found `bool`
|
- = note: expected type `<B<()> as Tr>::Ty`
- found type `bool`
+ = note: expected associated type `<B<()> as Tr>::Ty`
+ found type `bool`
+ = note: consider constraining the associated type `<B<()> as Tr>::Ty` to `bool` or calling a method that returns `<B<()> as Tr>::Ty`
+ = note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html
error[E0308]: mismatched types
- --> $DIR/defaults-specialization.rs:89:33
+ --> $DIR/defaults-specialization.rs:90:33
|
LL | let _: <B2<()> as Tr>::Ty = 0u8;
- | ^^^ expected associated type, found u8
+ | ^^^ expected associated type, found `u8`
|
- = note: expected type `<B2<()> as Tr>::Ty`
- found type `u8`
+ = note: expected associated type `<B2<()> as Tr>::Ty`
+ found type `u8`
+ = note: consider constraining the associated type `<B2<()> as Tr>::Ty` to `u8` or calling a method that returns `<B2<()> as Tr>::Ty`
+ = note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html
error[E0308]: mismatched types
- --> $DIR/defaults-specialization.rs:90:33
+ --> $DIR/defaults-specialization.rs:91:33
|
LL | let _: <B2<()> as Tr>::Ty = true;
- | ^^^^ expected associated type, found bool
+ | ^^^^ expected associated type, found `bool`
|
- = note: expected type `<B2<()> as Tr>::Ty`
- found type `bool`
+ = note: expected associated type `<B2<()> as Tr>::Ty`
+ found type `bool`
+ = note: consider constraining the associated type `<B2<()> as Tr>::Ty` to `bool` or calling a method that returns `<B2<()> as Tr>::Ty`
+ = note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html
error: aborting due to 9 previous errors
--> $DIR/defaults-suitability.rs:35:15
|
LL | trait Foo<T> {
- | ------------ required by `Foo`
+ | ------------
+ | | |
+ | | help: consider restricting this bound: `T: std::clone::Clone`
+ | required by `Foo`
LL | type Bar: Clone = Vec<T>;
| ^^^^^ the trait `std::clone::Clone` is not implemented for `T`
|
- = help: consider adding a `where T: std::clone::Clone` bound
= note: required because of the requirements on the impl of `std::clone::Clone` for `std::vec::Vec<T>`
error[E0277]: the trait bound `(): Foo<Self>` is not satisfied
--> $DIR/defaults-suitability.rs:74:15
|
LL | trait Foo2<T> {
- | ------------- required by `Foo2`
+ | -------------- help: consider further restricting the associated type: `where <Self as Foo2<T>>::Baz: std::clone::Clone`
+ | |
+ | required by `Foo2`
LL | type Bar: Clone = Vec<Self::Baz>;
| ^^^^^ the trait `std::clone::Clone` is not implemented for `<Self as Foo2<T>>::Baz`
|
- = help: consider adding a `where <Self as Foo2<T>>::Baz: std::clone::Clone` bound
= note: required because of the requirements on the impl of `std::clone::Clone` for `std::vec::Vec<<Self as Foo2<T>>::Baz>`
error[E0277]: the trait bound `<Self as Foo25<T>>::Baz: std::clone::Clone` is not satisfied
--> $DIR/defaults-suitability.rs:83:15
|
LL | trait Foo25<T: Clone> {
- | --------------------- required by `Foo25`
+ | ---------------------- help: consider further restricting the associated type: `where <Self as Foo25<T>>::Baz: std::clone::Clone`
+ | |
+ | required by `Foo25`
LL | type Bar: Clone = Vec<Self::Baz>;
| ^^^^^ the trait `std::clone::Clone` is not implemented for `<Self as Foo25<T>>::Baz`
|
- = help: consider adding a `where <Self as Foo25<T>>::Baz: std::clone::Clone` bound
= note: required because of the requirements on the impl of `std::clone::Clone` for `std::vec::Vec<<Self as Foo25<T>>::Baz>`
error[E0277]: the trait bound `T: std::clone::Clone` is not satisfied
LL | / trait Foo3<T> where
LL | | Self::Bar: Clone,
LL | | Self::Baz: Clone,
- | | ^^^^^ the trait `std::clone::Clone` is not implemented for `T`
+ | | ^^^^^ - help: consider further restricting type parameter `T`: `, T: std::clone::Clone`
+ | | |
+ | | the trait `std::clone::Clone` is not implemented for `T`
LL | |
... |
LL | | type Baz = T;
LL | | }
| |_- required by `Foo3`
- |
- = help: consider adding a `where T: std::clone::Clone` bound
error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
--> $DIR/defaults-suitability.rs:29:5
...
LL | type Output: Copy
| ^^^^ the trait `std::marker::Copy` is not implemented for `Self`
- |
- = help: consider adding a `where Self: std::marker::Copy` bound
error[E0277]: cannot add-assign `&'static str` to `Self`
--> $DIR/defaults-unsound-62211-1.rs:27:7
| ^^^^^^^^^^^^^^^^^^^^^^^ no implementation for `Self += &'static str`
|
= help: the trait `std::ops::AddAssign<&'static str>` is not implemented for `Self`
- = help: consider adding a `where Self: std::ops::AddAssign<&'static str>` bound
error[E0277]: the trait bound `Self: std::ops::Deref` is not satisfied
--> $DIR/defaults-unsound-62211-1.rs:25:7
...
LL | + Deref<Target = str>
| ^^^^^^^^^^^^^^^^^^^ the trait `std::ops::Deref` is not implemented for `Self`
- |
- = help: consider adding a `where Self: std::ops::Deref` bound
error[E0277]: `Self` doesn't implement `std::fmt::Display`
--> $DIR/defaults-unsound-62211-1.rs:30:7
|
= help: the trait `std::fmt::Display` is not implemented for `Self`
= note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
- = help: consider adding a `where Self: std::fmt::Display` bound
error[E0277]: `T` doesn't implement `std::fmt::Display`
--> $DIR/defaults-unsound-62211-1.rs:43:9
|
LL | impl<T> UncheckedCopy for T {}
- | ^^^^^^^^^^^^^ `T` cannot be formatted with the default formatter
+ | - ^^^^^^^^^^^^^ `T` cannot be formatted with the default formatter
+ | |
+ | help: consider restricting this bound: `T: std::fmt::Display`
|
= 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
- = help: consider adding a `where T: std::fmt::Display` bound
error[E0277]: the trait bound `T: std::ops::Deref` is not satisfied
--> $DIR/defaults-unsound-62211-1.rs:43:9
|
LL | impl<T> UncheckedCopy for T {}
- | ^^^^^^^^^^^^^ the trait `std::ops::Deref` is not implemented for `T`
- |
- = help: consider adding a `where T: std::ops::Deref` bound
+ | - ^^^^^^^^^^^^^ the trait `std::ops::Deref` is not implemented for `T`
+ | |
+ | help: consider restricting this bound: `T: std::ops::Deref`
error[E0277]: cannot add-assign `&'static str` to `T`
--> $DIR/defaults-unsound-62211-1.rs:43:9
|
LL | impl<T> UncheckedCopy for T {}
- | ^^^^^^^^^^^^^ no implementation for `T += &'static str`
+ | - ^^^^^^^^^^^^^ no implementation for `T += &'static str`
+ | |
+ | help: consider restricting this bound: `T: std::ops::AddAssign<&'static str>`
|
= help: the trait `std::ops::AddAssign<&'static str>` is not implemented for `T`
- = help: consider adding a `where T: std::ops::AddAssign<&'static str>` bound
error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied
--> $DIR/defaults-unsound-62211-1.rs:43:9
|
LL | impl<T> UncheckedCopy for T {}
- | ^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T`
- |
- = help: consider adding a `where T: std::marker::Copy` bound
+ | - ^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T`
+ | |
+ | help: consider restricting this bound: `T: std::marker::Copy`
error: aborting due to 8 previous errors
...
LL | type Output: Copy
| ^^^^ the trait `std::marker::Copy` is not implemented for `Self`
- |
- = help: consider adding a `where Self: std::marker::Copy` bound
error[E0277]: cannot add-assign `&'static str` to `Self`
--> $DIR/defaults-unsound-62211-2.rs:27:7
| ^^^^^^^^^^^^^^^^^^^^^^^ no implementation for `Self += &'static str`
|
= help: the trait `std::ops::AddAssign<&'static str>` is not implemented for `Self`
- = help: consider adding a `where Self: std::ops::AddAssign<&'static str>` bound
error[E0277]: the trait bound `Self: std::ops::Deref` is not satisfied
--> $DIR/defaults-unsound-62211-2.rs:25:7
...
LL | + Deref<Target = str>
| ^^^^^^^^^^^^^^^^^^^ the trait `std::ops::Deref` is not implemented for `Self`
- |
- = help: consider adding a `where Self: std::ops::Deref` bound
error[E0277]: `Self` doesn't implement `std::fmt::Display`
--> $DIR/defaults-unsound-62211-2.rs:30:7
|
= help: the trait `std::fmt::Display` is not implemented for `Self`
= note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
- = help: consider adding a `where Self: std::fmt::Display` bound
error[E0277]: `T` doesn't implement `std::fmt::Display`
--> $DIR/defaults-unsound-62211-2.rs:43:9
|
LL | impl<T> UncheckedCopy for T {}
- | ^^^^^^^^^^^^^ `T` cannot be formatted with the default formatter
+ | - ^^^^^^^^^^^^^ `T` cannot be formatted with the default formatter
+ | |
+ | help: consider restricting this bound: `T: std::fmt::Display`
|
= 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
- = help: consider adding a `where T: std::fmt::Display` bound
error[E0277]: the trait bound `T: std::ops::Deref` is not satisfied
--> $DIR/defaults-unsound-62211-2.rs:43:9
|
LL | impl<T> UncheckedCopy for T {}
- | ^^^^^^^^^^^^^ the trait `std::ops::Deref` is not implemented for `T`
- |
- = help: consider adding a `where T: std::ops::Deref` bound
+ | - ^^^^^^^^^^^^^ the trait `std::ops::Deref` is not implemented for `T`
+ | |
+ | help: consider restricting this bound: `T: std::ops::Deref`
error[E0277]: cannot add-assign `&'static str` to `T`
--> $DIR/defaults-unsound-62211-2.rs:43:9
|
LL | impl<T> UncheckedCopy for T {}
- | ^^^^^^^^^^^^^ no implementation for `T += &'static str`
+ | - ^^^^^^^^^^^^^ no implementation for `T += &'static str`
+ | |
+ | help: consider restricting this bound: `T: std::ops::AddAssign<&'static str>`
|
= help: the trait `std::ops::AddAssign<&'static str>` is not implemented for `T`
- = help: consider adding a `where T: std::ops::AddAssign<&'static str>` bound
error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied
--> $DIR/defaults-unsound-62211-2.rs:43:9
|
LL | impl<T> UncheckedCopy for T {}
- | ^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T`
- |
- = help: consider adding a `where T: std::marker::Copy` bound
+ | - ^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T`
+ | |
+ | help: consider restricting this bound: `T: std::marker::Copy`
error: aborting due to 8 previous errors
LL | const C: <Self::Fv as Foo>::Bar = 6665;
| ^^^^ expected associated type, found integer
|
- = note: expected type `<<Self as Baz>::Fv as Foo>::Bar`
- found type `{integer}`
+ = note: expected associated type `<<Self as Baz>::Fv as Foo>::Bar`
+ found type `{integer}`
+ = note: consider constraining the associated type `<<Self as Baz>::Fv as Foo>::Bar` to `{integer}` or calling a method that returns `<<Self as Baz>::Fv as Foo>::Bar`
+ = note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html
error: aborting due to previous error
|
= help: the trait `std::marker::Sized` is not implemented for `Self`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
- = help: consider adding a `where Self: std::marker::Sized` bound
error: aborting due to previous error