From f94eaeaf736e19b9249eb690a381202bcc5065b3 Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Tue, 8 Oct 2019 01:14:45 +0200 Subject: [PATCH] Fix rebase damage --- src/librustc_typeck/check/wfcheck.rs | 2 +- .../defaults-in-other-trait-items.rs | 4 +- .../defaults-in-other-trait-items.stderr | 2 +- .../defaults-specialization.rs | 1 + .../defaults-specialization.stderr | 80 ++++++++++++------- .../defaults-suitability.stderr | 22 ++--- .../defaults-unsound-62211-1.stderr | 28 +++---- .../defaults-unsound-62211-2.stderr | 28 +++---- .../ui/associated-types/issue-26681.stderr | 6 +- .../ui/associated-types/issue-63593.stderr | 1 - 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 tcx<'a>(&'a self) -> TyCtxt<'tcx> { } 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 @@ fn f(p: Self::A) { //~^ ERROR mismatched types //~| NOTE expected associated type, found `()` //~| NOTE expected associated type `::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 `::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 @@ fn make() -> u8 { 255 } struct E(T); impl Tr for E { + 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() -> as Tr>::Ty` - found type `fn() -> u8` + = note: expected fn pointer `fn() -> as Tr>::Ty` + found fn pointer `fn() -> u8` + = note: consider constraining the associated type ` as Tr>::Ty` to `u8` or calling a method that returns ` 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() -> as Tr>::Ty` - found type `fn() -> bool` + = note: expected fn pointer `fn() -> as Tr>::Ty` + found fn pointer `fn() -> bool` + = note: consider constraining the associated type ` as Tr>::Ty` to `bool` or calling a method that returns ` 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 `::Ty` because of return type LL | 0u8 - | ^^^ expected associated type, found u8 + | ^^^ expected associated type, found `u8` | - = note: expected type `::Ty` - found type `u8` + = note: expected associated type `::Ty` + found type `u8` + = note: consider constraining the associated type `::Ty` to `u8` or calling a method that returns `::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 ` as Tr>::Ty` because of return type | - = note: expected type ` as Tr>::Ty` - found type `u8` + = note: expected associated type ` as Tr>::Ty` + found type `u8` + = note: consider constraining the associated type ` as Tr>::Ty` to `u8` or calling a method that returns ` 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 ` as Tr>::Ty` because of return type | - = note: expected type ` as Tr>::Ty` - found type `bool` + = note: expected associated type ` as Tr>::Ty` + found type `bool` + = note: consider constraining the associated type ` as Tr>::Ty` to `bool` or calling a method that returns ` 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 _: as Tr>::Ty = 0u8; - | ^^^ expected associated type, found u8 + | ^^^ expected associated type, found `u8` | - = note: expected type ` as Tr>::Ty` - found type `u8` + = note: expected associated type ` as Tr>::Ty` + found type `u8` + = note: consider constraining the associated type ` as Tr>::Ty` to `u8` or calling a method that returns ` 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 _: as Tr>::Ty = true; - | ^^^^ expected associated type, found bool + | ^^^^ expected associated type, found `bool` | - = note: expected type ` as Tr>::Ty` - found type `bool` + = note: expected associated type ` as Tr>::Ty` + found type `bool` + = note: consider constraining the associated type ` as Tr>::Ty` to `bool` or calling a method that returns ` 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 _: as Tr>::Ty = 0u8; - | ^^^ expected associated type, found u8 + | ^^^ expected associated type, found `u8` | - = note: expected type ` as Tr>::Ty` - found type `u8` + = note: expected associated type ` as Tr>::Ty` + found type `u8` + = note: consider constraining the associated type ` as Tr>::Ty` to `u8` or calling a method that returns ` 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 _: as Tr>::Ty = true; - | ^^^^ expected associated type, found bool + | ^^^^ expected associated type, found `bool` | - = note: expected type ` as Tr>::Ty` - found type `bool` + = note: expected associated type ` as Tr>::Ty` + found type `bool` + = note: consider constraining the associated type ` as Tr>::Ty` to `bool` or calling a method that returns ` 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 { - | ------------ required by `Foo` + | ------------ + | | | + | | help: consider restricting this bound: `T: std::clone::Clone` + | required by `Foo` LL | type Bar: Clone = Vec; | ^^^^^ 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` error[E0277]: the trait bound `(): Foo` is not satisfied @@ -82,22 +84,24 @@ error[E0277]: the trait bound `>::Baz: std::clone::Clone` is not --> $DIR/defaults-suitability.rs:74:15 | LL | trait Foo2 { - | ------------- required by `Foo2` + | -------------- help: consider further restricting the associated type: `where >::Baz: std::clone::Clone` + | | + | required by `Foo2` LL | type Bar: Clone = Vec; | ^^^^^ the trait `std::clone::Clone` is not implemented for `>::Baz` | - = help: consider adding a `where >::Baz: std::clone::Clone` bound = note: required because of the requirements on the impl of `std::clone::Clone` for `std::vec::Vec<>::Baz>` error[E0277]: the trait bound `>::Baz: std::clone::Clone` is not satisfied --> $DIR/defaults-suitability.rs:83:15 | LL | trait Foo25 { - | --------------------- required by `Foo25` + | ---------------------- help: consider further restricting the associated type: `where >::Baz: std::clone::Clone` + | | + | required by `Foo25` LL | type Bar: Clone = Vec; | ^^^^^ the trait `std::clone::Clone` is not implemented for `>::Baz` | - = help: consider adding a `where >::Baz: std::clone::Clone` bound = note: required because of the requirements on the impl of `std::clone::Clone` for `std::vec::Vec<>::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 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 | ^^^^^^^^^^^^^^^^^^^ 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 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 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 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 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 | ^^^^^^^^^^^^^^^^^^^ 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 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 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 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 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: ::Bar = 6665; | ^^^^ expected associated type, found integer | - = note: expected type `<::Fv as Foo>::Bar` - found type `{integer}` + = note: expected associated type `<::Fv as Foo>::Bar` + found type `{integer}` + = note: consider constraining the associated type `<::Fv as Foo>::Bar` to `{integer}` or calling a method that returns `<::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 - = help: consider adding a `where Self: std::marker::Sized` bound error: aborting due to previous error -- 2.44.0