diff --git a/src/librustc_typeck/check/wfcheck.rs b/src/librustc_typeck/check/wfcheck.rs index b2169413f46e..58820dcb381c 100644 --- a/src/librustc_typeck/check/wfcheck.rs +++ b/src/librustc_typeck/check/wfcheck.rs @@ -443,6 +443,7 @@ fn check_associated_type_defaults(fcx: &FnCtxt<'_, '_>, trait_def_id: DefId) { // `>::Assoc` to the default type. let map = tcx .associated_items(trait_def_id) + .iter() .filter_map(|item| { if item.kind == ty::AssocKind::Type && item.defaultness.has_value() { // `>::Assoc` diff --git a/src/test/ui/associated-const/defaults-not-assumed-fail.rs b/src/test/ui/associated-const/defaults-not-assumed-fail.rs index 5a0704231ad9..d7a48cbd63ec 100644 --- a/src/test/ui/associated-const/defaults-not-assumed-fail.rs +++ b/src/test/ui/associated-const/defaults-not-assumed-fail.rs @@ -32,6 +32,7 @@ fn main() { assert_eq!(<() as Tr>::A, 255); assert_eq!(<() as Tr>::B, 0); // causes the error above //~^ ERROR evaluation of constant expression failed + //~| ERROR erroneous constant used assert_eq!(::A, 254); assert_eq!(::B, 255); diff --git a/src/test/ui/associated-const/defaults-not-assumed-fail.stderr b/src/test/ui/associated-const/defaults-not-assumed-fail.stderr index 365ad3224105..fe3721a91092 100644 --- a/src/test/ui/associated-const/defaults-not-assumed-fail.stderr +++ b/src/test/ui/associated-const/defaults-not-assumed-fail.stderr @@ -16,8 +16,16 @@ LL | assert_eq!(<() as Tr>::B, 0); // causes the error above | | | referenced constant has errors | - = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) + = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) -error: aborting due to 2 previous errors +error: erroneous constant used + --> $DIR/defaults-not-assumed-fail.rs:33:5 + | +LL | assert_eq!(<() as Tr>::B, 0); // causes the error above + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors + | + = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) + +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0080`. diff --git a/src/test/ui/associated-types/defaults-cyclic-fail-1.stderr b/src/test/ui/associated-types/defaults-cyclic-fail-1.stderr index 4f28a50701ad..6a8526f6aad1 100644 --- a/src/test/ui/associated-types/defaults-cyclic-fail-1.stderr +++ b/src/test/ui/associated-types/defaults-cyclic-fail-1.stderr @@ -1,29 +1,29 @@ error[E0275]: overflow evaluating the requirement `<() as Tr>::B` - --> $DIR/defaults-cyclic-fail-1.rs:12:6 + --> $DIR/defaults-cyclic-fail-1.rs:10:6 | LL | impl Tr for () {} | ^^ error[E0275]: overflow evaluating the requirement `::B` - --> $DIR/defaults-cyclic-fail-1.rs:30:6 + --> $DIR/defaults-cyclic-fail-1.rs:28:6 | LL | impl Tr for bool { | ^^ error[E0275]: overflow evaluating the requirement `::B` - --> $DIR/defaults-cyclic-fail-1.rs:37:6 + --> $DIR/defaults-cyclic-fail-1.rs:35:6 | LL | impl Tr for usize { | ^^ error[E0275]: overflow evaluating the requirement `::B` - --> $DIR/defaults-cyclic-fail-1.rs:32:5 + --> $DIR/defaults-cyclic-fail-1.rs:30:5 | LL | type A = Box; | ^^^^^^^^^^^^^^^^^^^^^^ error[E0275]: overflow evaluating the requirement `::A` - --> $DIR/defaults-cyclic-fail-1.rs:39:5 + --> $DIR/defaults-cyclic-fail-1.rs:37:5 | LL | type B = &'static Self::A; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/associated-types/defaults-cyclic-fail-2.rs b/src/test/ui/associated-types/defaults-cyclic-fail-2.rs index 2f2e84c60002..05091e3f498c 100644 --- a/src/test/ui/associated-types/defaults-cyclic-fail-2.rs +++ b/src/test/ui/associated-types/defaults-cyclic-fail-2.rs @@ -1,5 +1,3 @@ -// compile-fail - #![feature(associated_type_defaults)] // A more complex version of `defaults-cyclic-fail-1.rs`, with non-trivial defaults. diff --git a/src/test/ui/associated-types/defaults-cyclic-fail-2.stderr b/src/test/ui/associated-types/defaults-cyclic-fail-2.stderr index bbc130f11f72..78772df96388 100644 --- a/src/test/ui/associated-types/defaults-cyclic-fail-2.stderr +++ b/src/test/ui/associated-types/defaults-cyclic-fail-2.stderr @@ -1,29 +1,29 @@ error[E0275]: overflow evaluating the requirement `<() as Tr>::B` - --> $DIR/defaults-cyclic-fail-2.rs:14:6 + --> $DIR/defaults-cyclic-fail-2.rs:12:6 | LL | impl Tr for () {} | ^^ error[E0275]: overflow evaluating the requirement `::B` - --> $DIR/defaults-cyclic-fail-2.rs:32:6 + --> $DIR/defaults-cyclic-fail-2.rs:30:6 | LL | impl Tr for bool { | ^^ error[E0275]: overflow evaluating the requirement `::B` - --> $DIR/defaults-cyclic-fail-2.rs:39:6 + --> $DIR/defaults-cyclic-fail-2.rs:37:6 | LL | impl Tr for usize { | ^^ error[E0275]: overflow evaluating the requirement `::B` - --> $DIR/defaults-cyclic-fail-2.rs:34:5 + --> $DIR/defaults-cyclic-fail-2.rs:32:5 | LL | type A = Box; | ^^^^^^^^^^^^^^^^^^^^^^ error[E0275]: overflow evaluating the requirement `::A` - --> $DIR/defaults-cyclic-fail-2.rs:41:5 + --> $DIR/defaults-cyclic-fail-2.rs:39:5 | LL | type B = &'static Self::A; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ 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 b759276d2484..9ecfe49c2b57 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:39:25 + --> $DIR/defaults-in-other-trait-items.rs:37:25 | LL | const C: Self::Ty = 0u8; | ^^^ expected associated type, found `u8` diff --git a/src/test/ui/associated-types/defaults-mixed.rs b/src/test/ui/associated-types/defaults-mixed.rs index 7601ab71e4a2..c91b8de39f52 100644 --- a/src/test/ui/associated-types/defaults-mixed.rs +++ b/src/test/ui/associated-types/defaults-mixed.rs @@ -1,5 +1,3 @@ -// compile-fail - #![feature(associated_type_defaults)] // Tests that a trait with one defaulted and one non-defaulted assoc. type behaves properly. diff --git a/src/test/ui/associated-types/defaults-mixed.stderr b/src/test/ui/associated-types/defaults-mixed.stderr index 2d31d1dbdfee..69ddd5f2326d 100644 --- a/src/test/ui/associated-types/defaults-mixed.stderr +++ b/src/test/ui/associated-types/defaults-mixed.stderr @@ -1,5 +1,5 @@ error[E0046]: not all trait items implemented, missing: `Bar` - --> $DIR/defaults-mixed.rs:13:1 + --> $DIR/defaults-mixed.rs:11:1 | LL | type Bar; | --------- `Bar` from trait @@ -8,7 +8,7 @@ LL | impl Trait for () {} | ^^^^^^^^^^^^^^^^^ missing `Bar` in implementation error[E0046]: not all trait items implemented, missing: `Bar` - --> $DIR/defaults-mixed.rs:16:1 + --> $DIR/defaults-mixed.rs:14:1 | LL | type Bar; | --------- `Bar` from trait diff --git a/src/test/ui/associated-types/defaults-specialization.rs b/src/test/ui/associated-types/defaults-specialization.rs index cb0d231bfcd7..d0ed718b8392 100644 --- a/src/test/ui/associated-types/defaults-specialization.rs +++ b/src/test/ui/associated-types/defaults-specialization.rs @@ -1,7 +1,5 @@ //! Tests the interaction of associated type defaults and specialization. -// compile-fail - #![feature(associated_type_defaults, specialization)] trait Tr { diff --git a/src/test/ui/associated-types/defaults-specialization.stderr b/src/test/ui/associated-types/defaults-specialization.stderr index 15146d1a9c06..1dd536ec6360 100644 --- a/src/test/ui/associated-types/defaults-specialization.stderr +++ b/src/test/ui/associated-types/defaults-specialization.stderr @@ -1,5 +1,5 @@ error[E0053]: method `make` has an incompatible type for trait - --> $DIR/defaults-specialization.rs:20:18 + --> $DIR/defaults-specialization.rs:18:18 | LL | fn make() -> Self::Ty { | -------- type in trait @@ -13,7 +13,7 @@ LL | fn make() -> u8 { 0 } = 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 + --> $DIR/defaults-specialization.rs:34:18 | LL | fn make() -> Self::Ty { | -------- type in trait @@ -27,7 +27,7 @@ LL | fn make() -> bool { true } = 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 + --> $DIR/defaults-specialization.rs:9:9 | LL | fn make() -> Self::Ty { | -------- expected `::Ty` because of return type @@ -40,7 +40,7 @@ LL | 0u8 = 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 + --> $DIR/defaults-specialization.rs:25:29 | LL | fn make() -> Self::Ty { 0u8 } | -------- ^^^ expected associated type, found `u8` @@ -53,7 +53,7 @@ LL | fn make() -> Self::Ty { 0u8 } = 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 + --> $DIR/defaults-specialization.rs:43:29 | LL | fn make() -> Self::Ty { true } | -------- ^^^^ expected associated type, found `bool` @@ -66,7 +66,7 @@ LL | fn make() -> Self::Ty { true } = 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:86:32 | LL | let _: as Tr>::Ty = 0u8; | ----------------- ^^^ expected associated type, found `u8` @@ -79,7 +79,7 @@ LL | let _: as Tr>::Ty = 0u8; = 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:32 + --> $DIR/defaults-specialization.rs:87:32 | LL | let _: as Tr>::Ty = true; | ----------------- ^^^^ expected associated type, found `bool` @@ -92,7 +92,7 @@ LL | let _: as Tr>::Ty = true; = 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:88:33 | LL | let _: as Tr>::Ty = 0u8; | ------------------ ^^^ expected associated type, found `u8` @@ -105,7 +105,7 @@ LL | let _: as Tr>::Ty = 0u8; = note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html error[E0308]: mismatched types - --> $DIR/defaults-specialization.rs:91:33 + --> $DIR/defaults-specialization.rs:89:33 | LL | let _: as Tr>::Ty = true; | ------------------ ^^^^ expected associated type, found `bool` diff --git a/src/test/ui/associated-types/defaults-suitability.rs b/src/test/ui/associated-types/defaults-suitability.rs index 5a128e56bcb1..2be01cba105e 100644 --- a/src/test/ui/associated-types/defaults-suitability.rs +++ b/src/test/ui/associated-types/defaults-suitability.rs @@ -6,8 +6,6 @@ //! (eg. `type Assoc: Clone = NotClone`), and also against where clauses on //! the trait itself when possible -// compile-fail - #![feature(associated_type_defaults)] struct NotClone; diff --git a/src/test/ui/associated-types/defaults-suitability.stderr b/src/test/ui/associated-types/defaults-suitability.stderr index 861f178fd194..60e1821b300d 100644 --- a/src/test/ui/associated-types/defaults-suitability.stderr +++ b/src/test/ui/associated-types/defaults-suitability.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `NotClone: std::clone::Clone` is not satisfied - --> $DIR/defaults-suitability.rs:17:14 + --> $DIR/defaults-suitability.rs:15:14 | LL | trait Tr { | -------- required by `Tr` @@ -7,7 +7,7 @@ LL | type Ty: Clone = NotClone; | ^^^^^ the trait `std::clone::Clone` is not implemented for `NotClone` error[E0277]: the trait bound `NotClone: std::clone::Clone` is not satisfied - --> $DIR/defaults-suitability.rs:22:27 + --> $DIR/defaults-suitability.rs:20:27 | LL | trait Tr2 where Self::Ty: Clone { | --------------------------^^^^^ @@ -16,20 +16,22 @@ LL | trait Tr2 where Self::Ty: Clone { | required by `Tr2` error[E0277]: the trait bound `T: std::clone::Clone` is not satisfied - --> $DIR/defaults-suitability.rs:35:15 + --> $DIR/defaults-suitability.rs:33:15 | LL | trait Foo { - | ------------ - | | | - | | help: consider restricting this bound: `T: std::clone::Clone` - | required by `Foo` + | ------------ required by `Foo` LL | type Bar: Clone = Vec; | ^^^^^ the trait `std::clone::Clone` is not implemented for `T` | +help: consider restricting this type parameter with `T: std::clone::Clone` + --> $DIR/defaults-suitability.rs:32:11 + | +LL | trait Foo { + | ^ = 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 - --> $DIR/defaults-suitability.rs:41:17 + --> $DIR/defaults-suitability.rs:39:17 | LL | trait Bar: Sized { | ---------------- required by `Bar` @@ -38,7 +40,7 @@ LL | type Assoc: Foo = (); | ^^^^^^^^^ the trait `Foo` is not implemented for `()` error[E0277]: the trait bound `NotClone: IsU8` is not satisfied - --> $DIR/defaults-suitability.rs:61:18 + --> $DIR/defaults-suitability.rs:59:18 | LL | / trait D where LL | | Vec: Clone, @@ -51,7 +53,7 @@ LL | | } | |_- required by `D` error[E0277]: the trait bound `bool: IsU8` is not satisfied - --> $DIR/defaults-suitability.rs:63:11 + --> $DIR/defaults-suitability.rs:61:11 | LL | / trait D where LL | | Vec: Clone, @@ -66,7 +68,7 @@ LL | | } | |_- required by `D` error[E0277]: the trait bound `NotClone: std::clone::Clone` is not satisfied - --> $DIR/defaults-suitability.rs:59:23 + --> $DIR/defaults-suitability.rs:57:23 | LL | / trait D where LL | | Vec: Clone, @@ -81,7 +83,7 @@ LL | | } = note: required because of the requirements on the impl of `std::clone::Clone` for `std::vec::Vec` error[E0277]: the trait bound `>::Baz: std::clone::Clone` is not satisfied - --> $DIR/defaults-suitability.rs:74:15 + --> $DIR/defaults-suitability.rs:72:15 | LL | trait Foo2 { | -------------- help: consider further restricting the associated type: `where >::Baz: std::clone::Clone` @@ -93,7 +95,7 @@ LL | type Bar: Clone = Vec; = 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 + --> $DIR/defaults-suitability.rs:81:15 | LL | trait Foo25 { | ---------------------- help: consider further restricting the associated type: `where >::Baz: std::clone::Clone` @@ -105,22 +107,26 @@ LL | type Bar: Clone = Vec; = 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 - --> $DIR/defaults-suitability.rs:92:16 + --> $DIR/defaults-suitability.rs:90:16 | LL | / trait Foo3 where LL | | Self::Bar: Clone, LL | | Self::Baz: Clone, - | | ^^^^^ - help: consider further restricting type parameter `T`: `, T: std::clone::Clone` - | | | - | | the trait `std::clone::Clone` is not implemented for `T` + | | ^^^^^ the trait `std::clone::Clone` is not implemented for `T` LL | | ... | LL | | type Baz = T; LL | | } | |_- required by `Foo3` + | +help: consider restricting this type parameter with `where T: std::clone::Clone` + --> $DIR/defaults-suitability.rs:88:12 + | +LL | trait Foo3 where + | ^ error[E0277]: the size for values of type `[u8]` cannot be known at compilation time - --> $DIR/defaults-suitability.rs:29:5 + --> $DIR/defaults-suitability.rs:27:5 | LL | type Ty = Vec<[u8]>; | ^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time diff --git a/src/test/ui/associated-types/defaults-unsound-62211-1.rs b/src/test/ui/associated-types/defaults-unsound-62211-1.rs index 37d52ed16b61..c8b4734d6edc 100644 --- a/src/test/ui/associated-types/defaults-unsound-62211-1.rs +++ b/src/test/ui/associated-types/defaults-unsound-62211-1.rs @@ -7,8 +7,6 @@ //! Note that the underlying cause of this is still not yet fixed. //! See: https://github.com/rust-lang/rust/issues/33017 -// compile-fail - #![feature(associated_type_defaults)] use std::{ 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 35164c4f3d37..9c4a12601394 100644 --- a/src/test/ui/associated-types/defaults-unsound-62211-1.stderr +++ b/src/test/ui/associated-types/defaults-unsound-62211-1.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `Self: std::marker::Copy` is not satisfied - --> $DIR/defaults-unsound-62211-1.rs:23:18 + --> $DIR/defaults-unsound-62211-1.rs:21:18 | LL | trait UncheckedCopy: Sized { | -------------------------- required by `UncheckedCopy` @@ -8,7 +8,7 @@ LL | type Output: Copy | ^^^^ the trait `std::marker::Copy` is not implemented for `Self` error[E0277]: cannot add-assign `&'static str` to `Self` - --> $DIR/defaults-unsound-62211-1.rs:27:7 + --> $DIR/defaults-unsound-62211-1.rs:25:7 | LL | trait UncheckedCopy: Sized { | -------------------------- required by `UncheckedCopy` @@ -19,7 +19,7 @@ LL | + AddAssign<&'static str> = help: the trait `std::ops::AddAssign<&'static str>` is not implemented for `Self` error[E0277]: the trait bound `Self: std::ops::Deref` is not satisfied - --> $DIR/defaults-unsound-62211-1.rs:25:7 + --> $DIR/defaults-unsound-62211-1.rs:23:7 | LL | trait UncheckedCopy: Sized { | -------------------------- required by `UncheckedCopy` @@ -28,7 +28,7 @@ LL | + Deref | ^^^^^^^^^^^^^^^^^^^ the trait `std::ops::Deref` is not implemented for `Self` error[E0277]: `Self` doesn't implement `std::fmt::Display` - --> $DIR/defaults-unsound-62211-1.rs:30:7 + --> $DIR/defaults-unsound-62211-1.rs:28:7 | LL | trait UncheckedCopy: Sized { | -------------------------- required by `UncheckedCopy` @@ -40,41 +40,55 @@ LL | + Display = Self; = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead error[E0277]: `T` doesn't implement `std::fmt::Display` - --> $DIR/defaults-unsound-62211-1.rs:43:9 + --> $DIR/defaults-unsound-62211-1.rs:41:9 | LL | impl UncheckedCopy for T {} - | - ^^^^^^^^^^^^^ `T` cannot be formatted with the default formatter - | | - | help: consider restricting this bound: `T: std::fmt::Display` + | ^^^^^^^^^^^^^ `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 +help: consider restricting this type parameter with `T: std::fmt::Display` + --> $DIR/defaults-unsound-62211-1.rs:41:6 + | +LL | impl UncheckedCopy for T {} + | ^ error[E0277]: the trait bound `T: std::ops::Deref` is not satisfied - --> $DIR/defaults-unsound-62211-1.rs:43:9 + --> $DIR/defaults-unsound-62211-1.rs:41:9 | LL | impl UncheckedCopy for T {} - | - ^^^^^^^^^^^^^ the trait `std::ops::Deref` is not implemented for `T` - | | - | help: consider restricting this bound: `T: std::ops::Deref` + | ^^^^^^^^^^^^^ the trait `std::ops::Deref` is not implemented for `T` + | +help: consider restricting this type parameter with `T: std::ops::Deref` + --> $DIR/defaults-unsound-62211-1.rs:41:6 + | +LL | impl UncheckedCopy for T {} + | ^ error[E0277]: cannot add-assign `&'static str` to `T` - --> $DIR/defaults-unsound-62211-1.rs:43:9 + --> $DIR/defaults-unsound-62211-1.rs:41:9 | LL | impl UncheckedCopy for T {} - | - ^^^^^^^^^^^^^ no implementation for `T += &'static str` - | | - | help: consider restricting this bound: `T: std::ops::AddAssign<&'static str>` + | ^^^^^^^^^^^^^ no implementation for `T += &'static str` | = help: the trait `std::ops::AddAssign<&'static str>` is not implemented for `T` - -error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied - --> $DIR/defaults-unsound-62211-1.rs:43:9 +help: consider restricting this type parameter with `T: std::ops::AddAssign<&'static str>` + --> $DIR/defaults-unsound-62211-1.rs:41:6 | LL | impl UncheckedCopy for T {} - | - ^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T` - | | - | help: consider restricting this bound: `T: std::marker::Copy` + | ^ + +error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied + --> $DIR/defaults-unsound-62211-1.rs:41:9 + | +LL | impl UncheckedCopy for T {} + | ^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T` + | +help: consider restricting this type parameter with `T: std::marker::Copy` + --> $DIR/defaults-unsound-62211-1.rs:41:6 + | +LL | impl UncheckedCopy for T {} + | ^ error: aborting due to 8 previous errors diff --git a/src/test/ui/associated-types/defaults-unsound-62211-2.rs b/src/test/ui/associated-types/defaults-unsound-62211-2.rs index d042a1478a3a..aa343e759a8f 100644 --- a/src/test/ui/associated-types/defaults-unsound-62211-2.rs +++ b/src/test/ui/associated-types/defaults-unsound-62211-2.rs @@ -7,8 +7,6 @@ //! Note that the underlying cause of this is still not yet fixed. //! See: https://github.com/rust-lang/rust/issues/33017 -// compile-fail - #![feature(associated_type_defaults)] use std::{ 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 af66ee117a3a..4602fbc99fa6 100644 --- a/src/test/ui/associated-types/defaults-unsound-62211-2.stderr +++ b/src/test/ui/associated-types/defaults-unsound-62211-2.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `Self: std::marker::Copy` is not satisfied - --> $DIR/defaults-unsound-62211-2.rs:23:18 + --> $DIR/defaults-unsound-62211-2.rs:21:18 | LL | trait UncheckedCopy: Sized { | -------------------------- required by `UncheckedCopy` @@ -8,7 +8,7 @@ LL | type Output: Copy | ^^^^ the trait `std::marker::Copy` is not implemented for `Self` error[E0277]: cannot add-assign `&'static str` to `Self` - --> $DIR/defaults-unsound-62211-2.rs:27:7 + --> $DIR/defaults-unsound-62211-2.rs:25:7 | LL | trait UncheckedCopy: Sized { | -------------------------- required by `UncheckedCopy` @@ -19,7 +19,7 @@ LL | + AddAssign<&'static str> = help: the trait `std::ops::AddAssign<&'static str>` is not implemented for `Self` error[E0277]: the trait bound `Self: std::ops::Deref` is not satisfied - --> $DIR/defaults-unsound-62211-2.rs:25:7 + --> $DIR/defaults-unsound-62211-2.rs:23:7 | LL | trait UncheckedCopy: Sized { | -------------------------- required by `UncheckedCopy` @@ -28,7 +28,7 @@ LL | + Deref | ^^^^^^^^^^^^^^^^^^^ the trait `std::ops::Deref` is not implemented for `Self` error[E0277]: `Self` doesn't implement `std::fmt::Display` - --> $DIR/defaults-unsound-62211-2.rs:30:7 + --> $DIR/defaults-unsound-62211-2.rs:28:7 | LL | trait UncheckedCopy: Sized { | -------------------------- required by `UncheckedCopy` @@ -40,41 +40,55 @@ LL | + Display = Self; = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead error[E0277]: `T` doesn't implement `std::fmt::Display` - --> $DIR/defaults-unsound-62211-2.rs:43:9 + --> $DIR/defaults-unsound-62211-2.rs:41:9 | LL | impl UncheckedCopy for T {} - | - ^^^^^^^^^^^^^ `T` cannot be formatted with the default formatter - | | - | help: consider restricting this bound: `T: std::fmt::Display` + | ^^^^^^^^^^^^^ `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 +help: consider restricting this type parameter with `T: std::fmt::Display` + --> $DIR/defaults-unsound-62211-2.rs:41:6 + | +LL | impl UncheckedCopy for T {} + | ^ error[E0277]: the trait bound `T: std::ops::Deref` is not satisfied - --> $DIR/defaults-unsound-62211-2.rs:43:9 + --> $DIR/defaults-unsound-62211-2.rs:41:9 | LL | impl UncheckedCopy for T {} - | - ^^^^^^^^^^^^^ the trait `std::ops::Deref` is not implemented for `T` - | | - | help: consider restricting this bound: `T: std::ops::Deref` + | ^^^^^^^^^^^^^ the trait `std::ops::Deref` is not implemented for `T` + | +help: consider restricting this type parameter with `T: std::ops::Deref` + --> $DIR/defaults-unsound-62211-2.rs:41:6 + | +LL | impl UncheckedCopy for T {} + | ^ error[E0277]: cannot add-assign `&'static str` to `T` - --> $DIR/defaults-unsound-62211-2.rs:43:9 + --> $DIR/defaults-unsound-62211-2.rs:41:9 | LL | impl UncheckedCopy for T {} - | - ^^^^^^^^^^^^^ no implementation for `T += &'static str` - | | - | help: consider restricting this bound: `T: std::ops::AddAssign<&'static str>` + | ^^^^^^^^^^^^^ no implementation for `T += &'static str` | = help: the trait `std::ops::AddAssign<&'static str>` is not implemented for `T` - -error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied - --> $DIR/defaults-unsound-62211-2.rs:43:9 +help: consider restricting this type parameter with `T: std::ops::AddAssign<&'static str>` + --> $DIR/defaults-unsound-62211-2.rs:41:6 | LL | impl UncheckedCopy for T {} - | - ^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T` - | | - | help: consider restricting this bound: `T: std::marker::Copy` + | ^ + +error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied + --> $DIR/defaults-unsound-62211-2.rs:41:9 + | +LL | impl UncheckedCopy for T {} + | ^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T` + | +help: consider restricting this type parameter with `T: std::marker::Copy` + --> $DIR/defaults-unsound-62211-2.rs:41:6 + | +LL | impl UncheckedCopy for T {} + | ^ error: aborting due to 8 previous errors