about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/librustc_typeck/check/wfcheck.rs1
-rw-r--r--src/test/ui/associated-const/defaults-not-assumed-fail.rs1
-rw-r--r--src/test/ui/associated-const/defaults-not-assumed-fail.stderr12
-rw-r--r--src/test/ui/associated-types/defaults-cyclic-fail-1.stderr10
-rw-r--r--src/test/ui/associated-types/defaults-cyclic-fail-2.rs2
-rw-r--r--src/test/ui/associated-types/defaults-cyclic-fail-2.stderr10
-rw-r--r--src/test/ui/associated-types/defaults-in-other-trait-items.stderr2
-rw-r--r--src/test/ui/associated-types/defaults-mixed.rs2
-rw-r--r--src/test/ui/associated-types/defaults-mixed.stderr4
-rw-r--r--src/test/ui/associated-types/defaults-specialization.rs2
-rw-r--r--src/test/ui/associated-types/defaults-specialization.stderr18
-rw-r--r--src/test/ui/associated-types/defaults-suitability.rs2
-rw-r--r--src/test/ui/associated-types/defaults-suitability.stderr42
-rw-r--r--src/test/ui/associated-types/defaults-unsound-62211-1.rs2
-rw-r--r--src/test/ui/associated-types/defaults-unsound-62211-1.stderr54
-rw-r--r--src/test/ui/associated-types/defaults-unsound-62211-2.rs2
-rw-r--r--src/test/ui/associated-types/defaults-unsound-62211-2.stderr54
17 files changed, 126 insertions, 94 deletions
diff --git a/src/librustc_typeck/check/wfcheck.rs b/src/librustc_typeck/check/wfcheck.rs
index b2169413f46..58820dcb381 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) {
     // `<Self as Trait<...>>::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() {
                 // `<Self as Trait<...>>::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 5a0704231ad..d7a48cbd63e 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!(<u8 as Tr>::A, 254);
     assert_eq!(<u8 as Tr>::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 365ad322410..fe3721a9109 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 4f28a50701a..6a8526f6aad 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 `<bool as Tr>::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 `<usize as Tr>::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 `<bool as Tr>::B`
-  --> $DIR/defaults-cyclic-fail-1.rs:32:5
+  --> $DIR/defaults-cyclic-fail-1.rs:30:5
    |
 LL |     type A = Box<Self::B>;
    |     ^^^^^^^^^^^^^^^^^^^^^^
 
 error[E0275]: overflow evaluating the requirement `<usize as Tr>::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 2f2e84c6000..05091e3f498 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 bbc130f11f7..78772df9638 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 `<bool as Tr>::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 `<usize as Tr>::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 `<bool as Tr>::B`
-  --> $DIR/defaults-cyclic-fail-2.rs:34:5
+  --> $DIR/defaults-cyclic-fail-2.rs:32:5
    |
 LL |     type A = Box<Self::B>;
    |     ^^^^^^^^^^^^^^^^^^^^^^
 
 error[E0275]: overflow evaluating the requirement `<usize as Tr>::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 b759276d248..9ecfe49c2b5 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 7601ab71e4a..c91b8de39f5 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 2d31d1dbdfe..69ddd5f2326 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 cb0d231bfcd..d0ed718b839 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 15146d1a9c0..1dd536ec636 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 `<Self as Tr>::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 _: <B<()> as Tr>::Ty = 0u8;
    |            -----------------   ^^^ expected associated type, found `u8`
@@ -79,7 +79,7 @@ LL |     let _: <B<()> 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 _: <B<()> as Tr>::Ty = true;
    |            -----------------   ^^^^ expected associated type, found `bool`
@@ -92,7 +92,7 @@ LL |     let _: <B<()> 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 _: <B2<()> as Tr>::Ty = 0u8;
    |            ------------------   ^^^ expected associated type, found `u8`
@@ -105,7 +105,7 @@ LL |     let _: <B2<()> 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 _: <B2<()> 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 5a128e56bcb..2be01cba105 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 861f178fd19..60e1821b300 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<T> {
-   | ------------
-   | |         |
-   | |         help: consider restricting this bound: `T: std::clone::Clone`
-   | required by `Foo`
+   | ------------ required by `Foo`
 LL |     type Bar: Clone = Vec<T>;
    |               ^^^^^ 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<T> {
+   |           ^
    = 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:41:17
+  --> $DIR/defaults-suitability.rs:39:17
    |
 LL | trait Bar: Sized {
    | ---------------- required by `Bar`
@@ -38,7 +40,7 @@ LL |     type Assoc: Foo<Self> = ();
    |                 ^^^^^^^^^ the trait `Foo<Self>` is not implemented for `()`
 
 error[E0277]: the trait bound `NotClone: IsU8<NotClone>` is not satisfied
-  --> $DIR/defaults-suitability.rs:61:18
+  --> $DIR/defaults-suitability.rs:59:18
    |
 LL | / trait D where
 LL | |     Vec<Self::Assoc>: Clone,
@@ -51,7 +53,7 @@ LL | | }
    | |_- required by `D`
 
 error[E0277]: the trait bound `bool: IsU8<NotClone>` is not satisfied
-  --> $DIR/defaults-suitability.rs:63:11
+  --> $DIR/defaults-suitability.rs:61:11
    |
 LL | / trait D where
 LL | |     Vec<Self::Assoc>: 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<Self::Assoc>: Clone,
@@ -81,7 +83,7 @@ LL | | }
    = note: required because of the requirements on the impl of `std::clone::Clone` for `std::vec::Vec<NotClone>`
 
 error[E0277]: the trait bound `<Self as Foo2<T>>::Baz: std::clone::Clone` is not satisfied
-  --> $DIR/defaults-suitability.rs:74:15
+  --> $DIR/defaults-suitability.rs:72:15
    |
 LL | trait Foo2<T> {
    | -------------- help: consider further restricting the associated type: `where <Self as Foo2<T>>::Baz: std::clone::Clone`
@@ -93,7 +95,7 @@ LL |     type Bar: Clone = Vec<Self::Baz>;
    = 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
+  --> $DIR/defaults-suitability.rs:81:15
    |
 LL | trait Foo25<T: Clone> {
    | ---------------------- help: consider further restricting the associated type: `where <Self as Foo25<T>>::Baz: std::clone::Clone`
@@ -105,22 +107,26 @@ LL |     type Bar: Clone = Vec<Self::Baz>;
    = 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
-  --> $DIR/defaults-suitability.rs:92:16
+  --> $DIR/defaults-suitability.rs:90:16
    |
 LL | / trait Foo3<T> 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<T> 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 37d52ed16b6..c8b4734d6ed 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 35164c4f3d3..9c4a1260139 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<Target = str>
    |       ^^^^^^^^^^^^^^^^^^^ 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<T> 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<T> 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<T> UncheckedCopy for T {}
+   |         ^^^^^^^^^^^^^ 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<T> UncheckedCopy for T {}
-   |      -  ^^^^^^^^^^^^^ 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
+  --> $DIR/defaults-unsound-62211-1.rs:41:9
    |
 LL | impl<T> 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`
+help: consider restricting this type parameter with `T: std::ops::AddAssign<&'static str>`
+  --> $DIR/defaults-unsound-62211-1.rs:41:6
+   |
+LL | impl<T> UncheckedCopy for T {}
+   |      ^
 
 error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied
-  --> $DIR/defaults-unsound-62211-1.rs:43:9
+  --> $DIR/defaults-unsound-62211-1.rs:41:9
+   |
+LL | impl<T> 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<T> UncheckedCopy for T {}
-   |      -  ^^^^^^^^^^^^^ 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.rs b/src/test/ui/associated-types/defaults-unsound-62211-2.rs
index d042a1478a3..aa343e759a8 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 af66ee117a3..4602fbc99fa 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<Target = str>
    |       ^^^^^^^^^^^^^^^^^^^ 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<T> 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<T> 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<T> UncheckedCopy for T {}
+   |         ^^^^^^^^^^^^^ 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<T> UncheckedCopy for T {}
-   |      -  ^^^^^^^^^^^^^ 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
+  --> $DIR/defaults-unsound-62211-2.rs:41:9
    |
 LL | impl<T> 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`
+help: consider restricting this type parameter with `T: std::ops::AddAssign<&'static str>`
+  --> $DIR/defaults-unsound-62211-2.rs:41:6
+   |
+LL | impl<T> UncheckedCopy for T {}
+   |      ^
 
 error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied
-  --> $DIR/defaults-unsound-62211-2.rs:43:9
+  --> $DIR/defaults-unsound-62211-2.rs:41:9
+   |
+LL | impl<T> 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<T> UncheckedCopy for T {}
-   |      -  ^^^^^^^^^^^^^ 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