diff options
| author | Jonas Schievink <jonasschievink@gmail.com> | 2019-10-08 01:14:45 +0200 |
|---|---|---|
| committer | Jonas Schievink <jonasschievink@gmail.com> | 2020-02-21 19:41:22 +0100 |
| commit | f94eaeaf736e19b9249eb690a381202bcc5065b3 (patch) | |
| tree | 05a01deb4a0ea222601a74196aa2b3aad837cae2 /src | |
| parent | 24ec364713daad4f5014a0921c3dbc1b59ade1ac (diff) | |
| download | rust-f94eaeaf736e19b9249eb690a381202bcc5065b3.tar.gz rust-f94eaeaf736e19b9249eb690a381202bcc5065b3.zip | |
Fix rebase damage
Diffstat (limited to 'src')
10 files changed, 95 insertions, 79 deletions
diff --git a/src/librustc_typeck/check/wfcheck.rs b/src/librustc_typeck/check/wfcheck.rs index e39beb547d1..a6189a34664 100644 --- a/src/librustc_typeck/check/wfcheck.rs +++ b/src/librustc_typeck/check/wfcheck.rs @@ -496,7 +496,7 @@ fn check_associated_type_defaults( } 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 diff --git a/src/test/ui/associated-types/defaults-in-other-trait-items.rs b/src/test/ui/associated-types/defaults-in-other-trait-items.rs index 0455997b168..9f2e8aca477 100644 --- a/src/test/ui/associated-types/defaults-in-other-trait-items.rs +++ b/src/test/ui/associated-types/defaults-in-other-trait-items.rs @@ -10,7 +10,7 @@ trait Tr { //~^ 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 } } @@ -38,7 +38,7 @@ trait AssocConst { //~^ 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 } diff --git a/src/test/ui/associated-types/defaults-in-other-trait-items.stderr b/src/test/ui/associated-types/defaults-in-other-trait-items.stderr index 9ecfe49c2b5..b759276d248 100644 --- a/src/test/ui/associated-types/defaults-in-other-trait-items.stderr +++ b/src/test/ui/associated-types/defaults-in-other-trait-items.stderr @@ -10,7 +10,7 @@ LL | let () = p; = 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` diff --git a/src/test/ui/associated-types/defaults-specialization.rs b/src/test/ui/associated-types/defaults-specialization.rs index 833981fc8e3..cb0d231bfcd 100644 --- a/src/test/ui/associated-types/defaults-specialization.rs +++ b/src/test/ui/associated-types/defaults-specialization.rs @@ -66,6 +66,7 @@ impl Tr for D<bool> { struct E<T>(T); impl<T> Tr for E<T> { + default type Ty = bool; default fn make() -> Self::Ty { panic!(); } } diff --git a/src/test/ui/associated-types/defaults-specialization.stderr b/src/test/ui/associated-types/defaults-specialization.stderr index bd0fd7166f6..9b10940cbc4 100644 --- a/src/test/ui/associated-types/defaults-specialization.stderr +++ b/src/test/ui/associated-types/defaults-specialization.stderr @@ -5,10 +5,12 @@ LL | fn make() -> Self::Ty { | -------- 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 @@ -17,10 +19,12 @@ LL | fn make() -> Self::Ty { | -------- 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 @@ -28,68 +32,82 @@ error[E0308]: mismatched types 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 diff --git a/src/test/ui/associated-types/defaults-suitability.stderr b/src/test/ui/associated-types/defaults-suitability.stderr index dd45c9e4436..861f178fd19 100644 --- a/src/test/ui/associated-types/defaults-suitability.stderr +++ b/src/test/ui/associated-types/defaults-suitability.stderr @@ -19,11 +19,13 @@ error[E0277]: the trait bound `T: std::clone::Clone` is not satisfied --> $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 @@ -82,22 +84,24 @@ error[E0277]: the trait bound `<Self as Foo2<T>>::Baz: std::clone::Clone` is not --> $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 @@ -106,14 +110,14 @@ 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 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 e8eb085b791..35164c4f3d3 100644 --- a/src/test/ui/associated-types/defaults-unsound-62211-1.stderr +++ b/src/test/ui/associated-types/defaults-unsound-62211-1.stderr @@ -6,8 +6,6 @@ LL | trait UncheckedCopy: Sized { ... 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 @@ -19,7 +17,6 @@ LL | + AddAssign<&'static str> | ^^^^^^^^^^^^^^^^^^^^^^^ 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 @@ -29,8 +26,6 @@ LL | trait UncheckedCopy: Sized { ... 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 @@ -43,42 +38,43 @@ LL | + Display = Self; | = 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 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 a0b5d6b9cbb..af66ee117a3 100644 --- a/src/test/ui/associated-types/defaults-unsound-62211-2.stderr +++ b/src/test/ui/associated-types/defaults-unsound-62211-2.stderr @@ -6,8 +6,6 @@ LL | trait UncheckedCopy: Sized { ... 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 @@ -19,7 +17,6 @@ LL | + AddAssign<&'static str> | ^^^^^^^^^^^^^^^^^^^^^^^ 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 @@ -29,8 +26,6 @@ LL | trait UncheckedCopy: Sized { ... 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 @@ -43,42 +38,43 @@ LL | + Display = Self; | = 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 diff --git a/src/test/ui/associated-types/issue-26681.stderr b/src/test/ui/associated-types/issue-26681.stderr index 27175a247fa..da10933df92 100644 --- a/src/test/ui/associated-types/issue-26681.stderr +++ b/src/test/ui/associated-types/issue-26681.stderr @@ -4,8 +4,10 @@ error[E0308]: mismatched types 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 diff --git a/src/test/ui/associated-types/issue-63593.stderr b/src/test/ui/associated-types/issue-63593.stderr index 37dd52980d9..c27800f5a3f 100644 --- a/src/test/ui/associated-types/issue-63593.stderr +++ b/src/test/ui/associated-types/issue-63593.stderr @@ -8,7 +8,6 @@ LL | type This = Self; | = 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 |
