about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2020-01-31 16:47:00 -0800
committerEsteban Küber <esteban@kuber.com.ar>2020-02-02 11:53:10 -0800
commit413bfa4b98ac3a59c57ea9fa8cff2d87062fdc23 (patch)
tree877f1b4075dae6f201a8734480da9cd0dbaa5a7a
parent3ca1c5d5b5e0d19f55570f5d49d97100e9b524b3 (diff)
downloadrust-413bfa4b98ac3a59c57ea9fa8cff2d87062fdc23.tar.gz
rust-413bfa4b98ac3a59c57ea9fa8cff2d87062fdc23.zip
Wording changes to object unsafe trait errors
Stemming from the thread at https://twitter.com/indygreg/status/1223279056398929920
-rw-r--r--src/librustc/traits/error_reporting/mod.rs22
-rw-r--r--src/librustc/traits/object_safety.rs53
-rw-r--r--src/test/ui/associated-const/associated-const-in-trait.stderr6
-rw-r--r--src/test/ui/associated-item/issue-48027.stderr6
-rw-r--r--src/test/ui/coherence/coherence-impl-trait-for-trait-object-safe.stderr6
-rw-r--r--src/test/ui/did_you_mean/trait-object-reference-without-parens-suggestion.stderr2
-rw-r--r--src/test/ui/error-codes/E0033-teach.stderr6
-rw-r--r--src/test/ui/error-codes/E0033.stderr6
-rw-r--r--src/test/ui/error-codes/E0038.stderr6
-rw-r--r--src/test/ui/feature-gates/feature-gate-object_safe_for_dispatch.stderr26
-rw-r--r--src/test/ui/impl-trait/object-unsafe-trait-in-return-position-dyn-trait.stderr12
-rw-r--r--src/test/ui/issues/issue-18959.stderr6
-rw-r--r--src/test/ui/issues/issue-19380.stderr6
-rw-r--r--src/test/ui/issues/issue-19538.stderr13
-rw-r--r--src/test/ui/issues/issue-20692.stderr14
-rw-r--r--src/test/ui/issues/issue-26056.stderr2
-rw-r--r--src/test/ui/issues/issue-28576.stderr2
-rw-r--r--src/test/ui/issues/issue-38404.stderr2
-rw-r--r--src/test/ui/issues/issue-38604.stderr4
-rw-r--r--src/test/ui/issues/issue-50781.stderr5
-rw-r--r--src/test/ui/kindck/kindck-inherited-copy-bound.curr.stderr8
-rw-r--r--src/test/ui/kindck/kindck-inherited-copy-bound.object_safe_for_dispatch.stderr4
-rw-r--r--src/test/ui/object-safety/object-safety-associated-consts.curr.stderr6
-rw-r--r--src/test/ui/object-safety/object-safety-associated-consts.object_safe_for_dispatch.stderr5
-rw-r--r--src/test/ui/object-safety/object-safety-generics.curr.stderr12
-rw-r--r--src/test/ui/object-safety/object-safety-generics.object_safe_for_dispatch.stderr10
-rw-r--r--src/test/ui/object-safety/object-safety-issue-22040.stderr2
-rw-r--r--src/test/ui/object-safety/object-safety-mentions-Self.curr.stderr12
-rw-r--r--src/test/ui/object-safety/object-safety-mentions-Self.object_safe_for_dispatch.stderr10
-rw-r--r--src/test/ui/object-safety/object-safety-no-static.curr.stderr6
-rw-r--r--src/test/ui/object-safety/object-safety-no-static.object_safe_for_dispatch.stderr5
-rw-r--r--src/test/ui/object-safety/object-safety-sized-2.curr.stderr4
-rw-r--r--src/test/ui/object-safety/object-safety-sized-2.object_safe_for_dispatch.stderr4
-rw-r--r--src/test/ui/object-safety/object-safety-sized.curr.stderr4
-rw-r--r--src/test/ui/object-safety/object-safety-sized.object_safe_for_dispatch.stderr4
-rw-r--r--src/test/ui/object-safety/object-safety-supertrait-mentions-Self.stderr2
-rw-r--r--src/test/ui/resolve/issue-3907-2.stderr2
-rw-r--r--src/test/ui/self/arbitrary-self-types-not-object-safe.curr.stderr11
-rw-r--r--src/test/ui/self/arbitrary-self-types-not-object-safe.object_safe_for_dispatch.stderr5
-rw-r--r--src/test/ui/suggestions/object-unsafe-trait-should-use-self.stderr10
-rw-r--r--src/test/ui/traits/trait-alias/trait-alias-object-fail.stderr2
-rw-r--r--src/test/ui/traits/trait-item-privacy.stderr12
-rw-r--r--src/test/ui/traits/trait-object-macro-matcher.stderr2
-rw-r--r--src/test/ui/traits/trait-object-safety.stderr11
-rw-r--r--src/test/ui/traits/trait-test-2.stderr19
-rw-r--r--src/test/ui/type/type-parameter-defaults-referencing-Self-ppaux.stderr6
-rw-r--r--src/test/ui/wf/wf-convert-unsafe-trait-obj-box.stderr12
-rw-r--r--src/test/ui/wf/wf-convert-unsafe-trait-obj.stderr12
-rw-r--r--src/test/ui/wf/wf-fn-where-clause.stderr2
-rw-r--r--src/test/ui/wf/wf-object-safe.stderr6
-rw-r--r--src/test/ui/wf/wf-unsafe-trait-obj-match.stderr8
51 files changed, 332 insertions, 91 deletions
diff --git a/src/librustc/traits/error_reporting/mod.rs b/src/librustc/traits/error_reporting/mod.rs
index f15fa779534..f2cc8a303a9 100644
--- a/src/librustc/traits/error_reporting/mod.rs
+++ b/src/librustc/traits/error_reporting/mod.rs
@@ -1034,6 +1034,10 @@ pub fn report_object_safety_error(
     violations: Vec<ObjectSafetyViolation>,
 ) -> DiagnosticBuilder<'tcx> {
     let trait_str = tcx.def_path_str(trait_def_id);
+    let trait_span = tcx.hir().get_if_local(trait_def_id).and_then(|node| match node {
+        hir::Node::Item(item) => Some(item.ident.span),
+        _ => None,
+    });
     let span = tcx.sess.source_map().def_span(span);
     let mut err = struct_span_err!(
         tcx.sess,
@@ -1045,6 +1049,7 @@ pub fn report_object_safety_error(
     err.span_label(span, format!("the trait `{}` cannot be made into an object", trait_str));
 
     let mut reported_violations = FxHashSet::default();
+    let mut had_span_label = false;
     for violation in violations {
         if let ObjectSafetyViolation::SizedSelf(sp) = &violation {
             if !sp.is_empty() {
@@ -1055,15 +1060,28 @@ pub fn report_object_safety_error(
         }
         if reported_violations.insert(violation.clone()) {
             let spans = violation.spans();
+            let msg = if trait_span.is_none() || spans.is_empty() {
+                format!("the trait cannot be made into an object because {}", violation.error_msg())
+            } else {
+                had_span_label = true;
+                format!("...because {}", violation.error_msg())
+            };
             if spans.is_empty() {
-                err.note(&violation.error_msg());
+                err.note(&msg);
             } else {
                 for span in spans {
-                    err.span_label(span, violation.error_msg());
+                    err.span_label(span, &msg);
                 }
             }
+            if let (Some(_), Some(note)) = (trait_span, violation.solution()) {
+                // Only provide the help if its a local trait, otherwise it's not actionable.
+                err.help(&note);
+            }
         }
     }
+    if let (Some(trait_span), true) = (trait_span, had_span_label) {
+        err.span_label(trait_span, "this trait cannot be made into an object...");
+    }
 
     if tcx.sess.trait_methods_not_found.borrow().contains(&span) {
         // Avoid emitting error caused by non-existing method (#58734)
diff --git a/src/librustc/traits/object_safety.rs b/src/librustc/traits/object_safety.rs
index dec9ef4f421..ac9e4950b72 100644
--- a/src/librustc/traits/object_safety.rs
+++ b/src/librustc/traits/object_safety.rs
@@ -43,12 +43,9 @@ pub enum ObjectSafetyViolation {
 impl ObjectSafetyViolation {
     pub fn error_msg(&self) -> Cow<'static, str> {
         match *self {
-            ObjectSafetyViolation::SizedSelf(_) => {
-                "traits that require `Self: Sized` cannot be made into an object".into()
-            }
+            ObjectSafetyViolation::SizedSelf(_) => "it requires `Self: Sized`".into(),
             ObjectSafetyViolation::SupertraitSelf => {
-                "the trait cannot use `Self` as a type parameter \
-                 in the supertraits or where-clauses"
+                "it cannot use `Self` as a type parameter in the supertraits or `where`-clauses"
                     .into()
             }
             ObjectSafetyViolation::Method(name, MethodViolationCode::StaticMethod, _) => {
@@ -63,19 +60,45 @@ impl ObjectSafetyViolation {
                 name,
                 MethodViolationCode::WhereClauseReferencesSelf,
                 _,
-            ) => format!("method `{}` references the `Self` type in where clauses", name).into(),
+            ) => {
+                format!("method `{}` references the `Self` type in its `where` clause", name).into()
+            }
             ObjectSafetyViolation::Method(name, MethodViolationCode::Generic, _) => {
                 format!("method `{}` has generic type parameters", name).into()
             }
             ObjectSafetyViolation::Method(name, MethodViolationCode::UndispatchableReceiver, _) => {
                 format!("method `{}`'s `self` parameter cannot be dispatched on", name).into()
             }
+            ObjectSafetyViolation::AssocConst(_, DUMMY_SP) => {
+                "it cannot contain associated consts".into()
+            }
             ObjectSafetyViolation::AssocConst(name, _) => {
-                format!("the trait cannot contain associated consts like `{}`", name).into()
+                format!("it cannot contain associated consts like `{}`", name).into()
             }
         }
     }
 
+    pub fn solution(&self) -> Option<String> {
+        Some(match *self {
+            ObjectSafetyViolation::SizedSelf(_) | ObjectSafetyViolation::SupertraitSelf => {
+                return None;
+            }
+            ObjectSafetyViolation::Method(name, MethodViolationCode::StaticMethod, _) => format!(
+                "consider turning `{}` into a method by giving it a `&self` argument or \
+                 constraining it with `where Self: Sized`",
+                name
+            ),
+            ObjectSafetyViolation::Method(name, MethodViolationCode::UndispatchableReceiver, _) => {
+                format!("consider changing method `{}`'s `self` parameter to be `&self`", name)
+                    .into()
+            }
+            ObjectSafetyViolation::AssocConst(name, _)
+            | ObjectSafetyViolation::Method(name, ..) => {
+                format!("consider moving `{}` to another trait", name)
+            }
+        })
+    }
+
     pub fn spans(&self) -> SmallVec<[Span; 1]> {
         // When `span` comes from a separate crate, it'll be `DUMMY_SP`. Treat it as `None` so
         // diagnostics use a `note` instead of a `span_label`.
@@ -190,7 +213,21 @@ fn object_safety_violations_for_trait(
                         tcx.def_path_str(trait_def_id)
                     ),
                 );
-                err.span_label(*span, violation.error_msg());
+                let node = tcx.hir().get_if_local(trait_def_id);
+                let msg = if let Some(hir::Node::Item(item)) = node {
+                    err.span_label(item.ident.span, "this trait cannot be made into an object...");
+                    format!("...because {}", violation.error_msg())
+                } else {
+                    format!(
+                        "the trait cannot be made into an object because {}",
+                        violation.error_msg()
+                    )
+                };
+                err.span_label(*span, &msg);
+                if let (Some(_), Some(note)) = (node, violation.solution()) {
+                    // Only provide the help if its a local trait, otherwise it's not actionable.
+                    err.help(&note);
+                }
                 err.emit();
                 false
             } else {
diff --git a/src/test/ui/associated-const/associated-const-in-trait.stderr b/src/test/ui/associated-const/associated-const-in-trait.stderr
index a5d7fc5b702..b9101c86d21 100644
--- a/src/test/ui/associated-const/associated-const-in-trait.stderr
+++ b/src/test/ui/associated-const/associated-const-in-trait.stderr
@@ -1,11 +1,15 @@
 error[E0038]: the trait `Trait` cannot be made into an object
   --> $DIR/associated-const-in-trait.rs:9:6
    |
+LL | trait Trait {
+   |       ----- this trait cannot be made into an object...
 LL |     const N: usize;
-   |           - the trait cannot contain associated consts like `N`
+   |           - ...because it cannot contain associated consts like `N`
 ...
 LL | impl dyn Trait {
    |      ^^^^^^^^^ the trait `Trait` cannot be made into an object
+   |
+   = help: consider moving `N` to another trait
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/associated-item/issue-48027.stderr b/src/test/ui/associated-item/issue-48027.stderr
index ddabd552897..e8442c6c9ac 100644
--- a/src/test/ui/associated-item/issue-48027.stderr
+++ b/src/test/ui/associated-item/issue-48027.stderr
@@ -1,11 +1,15 @@
 error[E0038]: the trait `Bar` cannot be made into an object
   --> $DIR/issue-48027.rs:6:6
    |
+LL | trait Bar {
+   |       --- this trait cannot be made into an object...
 LL |     const X: usize;
-   |           - the trait cannot contain associated consts like `X`
+   |           - ...because it cannot contain associated consts like `X`
 ...
 LL | impl dyn Bar {}
    |      ^^^^^^^ the trait `Bar` cannot be made into an object
+   |
+   = help: consider moving `X` to another trait
 
 error[E0283]: type annotations needed
   --> $DIR/issue-48027.rs:3:32
diff --git a/src/test/ui/coherence/coherence-impl-trait-for-trait-object-safe.stderr b/src/test/ui/coherence/coherence-impl-trait-for-trait-object-safe.stderr
index ed6be60de46..c999cabcc14 100644
--- a/src/test/ui/coherence/coherence-impl-trait-for-trait-object-safe.stderr
+++ b/src/test/ui/coherence/coherence-impl-trait-for-trait-object-safe.stderr
@@ -2,9 +2,13 @@ error[E0038]: the trait `NotObjectSafe` cannot be made into an object
   --> $DIR/coherence-impl-trait-for-trait-object-safe.rs:7:6
    |
 LL | trait NotObjectSafe { fn eq(&self, other: Self); }
-   |                          -- method `eq` references the `Self` type in its parameters or return type
+   |       -------------      -- ...because method `eq` references the `Self` type in its parameters or return type
+   |       |
+   |       this trait cannot be made into an object...
 LL | impl NotObjectSafe for dyn NotObjectSafe { }
    |      ^^^^^^^^^^^^^ the trait `NotObjectSafe` cannot be made into an object
+   |
+   = help: consider moving `eq` to another trait
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/did_you_mean/trait-object-reference-without-parens-suggestion.stderr b/src/test/ui/did_you_mean/trait-object-reference-without-parens-suggestion.stderr
index 070917f2db9..333754891c1 100644
--- a/src/test/ui/did_you_mean/trait-object-reference-without-parens-suggestion.stderr
+++ b/src/test/ui/did_you_mean/trait-object-reference-without-parens-suggestion.stderr
@@ -16,7 +16,7 @@ error[E0038]: the trait `std::marker::Copy` cannot be made into an object
 LL |     let _: &Copy + 'static;
    |            ^^^^^ the trait `std::marker::Copy` cannot be made into an object
    |
-   = note: traits that require `Self: Sized` cannot be made into an object
+   = note: the trait cannot be made into an object because it requires `Self: Sized`
 
 error: aborting due to 3 previous errors
 
diff --git a/src/test/ui/error-codes/E0033-teach.stderr b/src/test/ui/error-codes/E0033-teach.stderr
index 80f3d4441bd..050ea63aa4f 100644
--- a/src/test/ui/error-codes/E0033-teach.stderr
+++ b/src/test/ui/error-codes/E0033-teach.stderr
@@ -7,11 +7,15 @@ LL |     let trait_obj: &dyn SomeTrait = SomeTrait;
 error[E0038]: the trait `SomeTrait` cannot be made into an object
   --> $DIR/E0033-teach.rs:8:20
    |
+LL | trait SomeTrait {
+   |       --------- this trait cannot be made into an object...
 LL |     fn foo();
-   |        --- associated function `foo` has no `self` parameter
+   |        --- ...because associated function `foo` has no `self` parameter
 ...
 LL |     let trait_obj: &dyn SomeTrait = SomeTrait;
    |                    ^^^^^^^^^^^^^^ the trait `SomeTrait` cannot be made into an object
+   |
+   = help: consider turning `foo` into a method by giving it a `&self` argument or constraining it with `where Self: Sized`
 
 error[E0033]: type `&dyn SomeTrait` cannot be dereferenced
   --> $DIR/E0033-teach.rs:12:9
diff --git a/src/test/ui/error-codes/E0033.stderr b/src/test/ui/error-codes/E0033.stderr
index c2843796cc8..c736fbcf92a 100644
--- a/src/test/ui/error-codes/E0033.stderr
+++ b/src/test/ui/error-codes/E0033.stderr
@@ -7,11 +7,15 @@ LL |     let trait_obj: &dyn SomeTrait = SomeTrait;
 error[E0038]: the trait `SomeTrait` cannot be made into an object
   --> $DIR/E0033.rs:6:20
    |
+LL | trait SomeTrait {
+   |       --------- this trait cannot be made into an object...
 LL |     fn foo();
-   |        --- associated function `foo` has no `self` parameter
+   |        --- ...because associated function `foo` has no `self` parameter
 ...
 LL |     let trait_obj: &dyn SomeTrait = SomeTrait;
    |                    ^^^^^^^^^^^^^^ the trait `SomeTrait` cannot be made into an object
+   |
+   = help: consider turning `foo` into a method by giving it a `&self` argument or constraining it with `where Self: Sized`
 
 error[E0033]: type `&dyn SomeTrait` cannot be dereferenced
   --> $DIR/E0033.rs:10:9
diff --git a/src/test/ui/error-codes/E0038.stderr b/src/test/ui/error-codes/E0038.stderr
index 6eaf6e4a8aa..62b6f4cf246 100644
--- a/src/test/ui/error-codes/E0038.stderr
+++ b/src/test/ui/error-codes/E0038.stderr
@@ -1,11 +1,15 @@
 error[E0038]: the trait `Trait` cannot be made into an object
   --> $DIR/E0038.rs:5:16
    |
+LL | trait Trait {
+   |       ----- this trait cannot be made into an object...
 LL |     fn foo(&self) -> Self;
-   |        --- method `foo` references the `Self` type in its parameters or return type
+   |        --- ...because method `foo` references the `Self` type in its parameters or return type
 ...
 LL | fn call_foo(x: Box<dyn Trait>) {
    |                ^^^^^^^^^^^^^^ the trait `Trait` cannot be made into an object
+   |
+   = help: consider moving `foo` to another trait
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/feature-gates/feature-gate-object_safe_for_dispatch.stderr b/src/test/ui/feature-gates/feature-gate-object_safe_for_dispatch.stderr
index ce983069405..29059880668 100644
--- a/src/test/ui/feature-gates/feature-gate-object_safe_for_dispatch.stderr
+++ b/src/test/ui/feature-gates/feature-gate-object_safe_for_dispatch.stderr
@@ -2,7 +2,9 @@ error[E0038]: the trait `NonObjectSafe1` cannot be made into an object
   --> $DIR/feature-gate-object_safe_for_dispatch.rs:18:38
    |
 LL | trait NonObjectSafe1: Sized {}
-   |                       ----- traits that require `Self: Sized` cannot be made into an object
+   |       --------------  ----- ...because it requires `Self: Sized`
+   |       |
+   |       this trait cannot be made into an object...
 ...
 LL | fn takes_non_object_safe_ref<T>(obj: &dyn NonObjectSafe1) {
    |                                      ^^^^^^^^^^^^^^^^^^^ the trait `NonObjectSafe1` cannot be made into an object
@@ -10,35 +12,49 @@ LL | fn takes_non_object_safe_ref<T>(obj: &dyn NonObjectSafe1) {
 error[E0038]: the trait `NonObjectSafe2` cannot be made into an object
   --> $DIR/feature-gate-object_safe_for_dispatch.rs:22:36
    |
+LL | trait NonObjectSafe2 {
+   |       -------------- this trait cannot be made into an object...
 LL |     fn static_fn() {}
-   |        --------- associated function `static_fn` has no `self` parameter
+   |        --------- ...because associated function `static_fn` has no `self` parameter
 ...
 LL | fn return_non_object_safe_ref() -> &'static dyn NonObjectSafe2 {
    |                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `NonObjectSafe2` cannot be made into an object
+   |
+   = help: consider turning `static_fn` into a method by giving it a `&self` argument or constraining it with `where Self: Sized`
 
 error[E0038]: the trait `NonObjectSafe3` cannot be made into an object
   --> $DIR/feature-gate-object_safe_for_dispatch.rs:27:35
    |
+LL | trait NonObjectSafe3 {
+   |       -------------- this trait cannot be made into an object...
 LL |     fn foo<T>(&self);
-   |        --- method `foo` has generic type parameters
+   |        --- ...because method `foo` has generic type parameters
 ...
 LL | fn takes_non_object_safe_box(obj: Box<dyn NonObjectSafe3>) {
    |                                   ^^^^^^^^^^^^^^^^^^^^^^^ the trait `NonObjectSafe3` cannot be made into an object
+   |
+   = help: consider moving `foo` to another trait
 
 error[E0038]: the trait `NonObjectSafe4` cannot be made into an object
   --> $DIR/feature-gate-object_safe_for_dispatch.rs:31:35
    |
+LL | trait NonObjectSafe4 {
+   |       -------------- this trait cannot be made into an object...
 LL |     fn foo(&self, &Self);
-   |        --- method `foo` references the `Self` type in its parameters or return type
+   |        --- ...because method `foo` references the `Self` type in its parameters or return type
 ...
 LL | fn return_non_object_safe_rc() -> std::rc::Rc<dyn NonObjectSafe4> {
    |                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `NonObjectSafe4` cannot be made into an object
+   |
+   = help: consider moving `foo` to another trait
 
 error[E0038]: the trait `NonObjectSafe1` cannot be made into an object
   --> $DIR/feature-gate-object_safe_for_dispatch.rs:38:6
    |
 LL | trait NonObjectSafe1: Sized {}
-   |                       ----- traits that require `Self: Sized` cannot be made into an object
+   |       --------------  ----- ...because it requires `Self: Sized`
+   |       |
+   |       this trait cannot be made into an object...
 ...
 LL | impl Trait for dyn NonObjectSafe1 {}
    |      ^^^^^ the trait `NonObjectSafe1` cannot be made into an object
diff --git a/src/test/ui/impl-trait/object-unsafe-trait-in-return-position-dyn-trait.stderr b/src/test/ui/impl-trait/object-unsafe-trait-in-return-position-dyn-trait.stderr
index ff4bfc30a4a..1443be0b30e 100644
--- a/src/test/ui/impl-trait/object-unsafe-trait-in-return-position-dyn-trait.stderr
+++ b/src/test/ui/impl-trait/object-unsafe-trait-in-return-position-dyn-trait.stderr
@@ -1,20 +1,28 @@
 error[E0038]: the trait `NotObjectSafe` cannot be made into an object
   --> $DIR/object-unsafe-trait-in-return-position-dyn-trait.rs:21:13
    |
+LL | trait NotObjectSafe {
+   |       ------------- this trait cannot be made into an object...
 LL |     fn foo() -> Self;
-   |        --- associated function `foo` has no `self` parameter
+   |        --- ...because associated function `foo` has no `self` parameter
 ...
 LL | fn car() -> dyn NotObjectSafe {
    |             ^^^^^^^^^^^^^^^^^ the trait `NotObjectSafe` cannot be made into an object
+   |
+   = help: consider turning `foo` into a method by giving it a `&self` argument or constraining it with `where Self: Sized`
 
 error[E0038]: the trait `NotObjectSafe` cannot be made into an object
   --> $DIR/object-unsafe-trait-in-return-position-dyn-trait.rs:28:13
    |
+LL | trait NotObjectSafe {
+   |       ------------- this trait cannot be made into an object...
 LL |     fn foo() -> Self;
-   |        --- associated function `foo` has no `self` parameter
+   |        --- ...because associated function `foo` has no `self` parameter
 ...
 LL | fn cat() -> Box<dyn NotObjectSafe> {
    |             ^^^^^^^^^^^^^^^^^^^^^^ the trait `NotObjectSafe` cannot be made into an object
+   |
+   = help: consider turning `foo` into a method by giving it a `&self` argument or constraining it with `where Self: Sized`
 
 error: aborting due to 2 previous errors
 
diff --git a/src/test/ui/issues/issue-18959.stderr b/src/test/ui/issues/issue-18959.stderr
index 0c59486b416..b3ba7aecad0 100644
--- a/src/test/ui/issues/issue-18959.stderr
+++ b/src/test/ui/issues/issue-18959.stderr
@@ -2,10 +2,14 @@ error[E0038]: the trait `Bar` cannot be made into an object
   --> $DIR/issue-18959.rs:11:11
    |
 LL | pub trait Foo { fn foo<T>(&self, ext_thing: &T); }
-   |                    --- method `foo` has generic type parameters
+   |                    --- ...because method `foo` has generic type parameters
+LL | pub trait Bar: Foo { }
+   |           --- this trait cannot be made into an object...
 ...
 LL | fn foo(b: &dyn Bar) {
    |           ^^^^^^^^ the trait `Bar` cannot be made into an object
+   |
+   = help: consider moving `foo` to another trait
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/issues/issue-19380.stderr b/src/test/ui/issues/issue-19380.stderr
index 92bfdf1f26e..22e744f8841 100644
--- a/src/test/ui/issues/issue-19380.stderr
+++ b/src/test/ui/issues/issue-19380.stderr
@@ -1,11 +1,15 @@
 error[E0038]: the trait `Qiz` cannot be made into an object
   --> $DIR/issue-19380.rs:11:3
    |
+LL | trait Qiz {
+   |       --- this trait cannot be made into an object...
 LL |   fn qiz();
-   |      --- associated function `qiz` has no `self` parameter
+   |      --- ...because associated function `qiz` has no `self` parameter
 ...
 LL |   foos: &'static [&'static (dyn Qiz + 'static)]
    |   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Qiz` cannot be made into an object
+   |
+   = help: consider turning `qiz` into a method by giving it a `&self` argument or constraining it with `where Self: Sized`
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/issues/issue-19538.stderr b/src/test/ui/issues/issue-19538.stderr
index 83c03b514dd..b6033e47b1a 100644
--- a/src/test/ui/issues/issue-19538.stderr
+++ b/src/test/ui/issues/issue-19538.stderr
@@ -2,20 +2,29 @@ error[E0038]: the trait `Bar` cannot be made into an object
   --> $DIR/issue-19538.rs:17:15
    |
 LL |     fn foo<T>(&self, val: T);
-   |        --- method `foo` has generic type parameters
+   |        --- ...because method `foo` has generic type parameters
+...
+LL | trait Bar: Foo { }
+   |       --- this trait cannot be made into an object...
 ...
 LL |     let test: &mut dyn Bar = &mut thing;
    |               ^^^^^^^^^^^^ the trait `Bar` cannot be made into an object
+   |
+   = help: consider moving `foo` to another trait
 
 error[E0038]: the trait `Bar` cannot be made into an object
   --> $DIR/issue-19538.rs:17:30
    |
 LL |     fn foo<T>(&self, val: T);
-   |        --- method `foo` has generic type parameters
+   |        --- ...because method `foo` has generic type parameters
+...
+LL | trait Bar: Foo { }
+   |       --- this trait cannot be made into an object...
 ...
 LL |     let test: &mut dyn Bar = &mut thing;
    |                              ^^^^^^^^^^ the trait `Bar` cannot be made into an object
    |
+   = help: consider moving `foo` to another trait
    = note: required because of the requirements on the impl of `std::ops::CoerceUnsized<&mut dyn Bar>` for `&mut Thing`
    = note: required by cast to type `&mut dyn Bar`
 
diff --git a/src/test/ui/issues/issue-20692.stderr b/src/test/ui/issues/issue-20692.stderr
index 552b65b3620..ca2611e0f9e 100644
--- a/src/test/ui/issues/issue-20692.stderr
+++ b/src/test/ui/issues/issue-20692.stderr
@@ -2,9 +2,10 @@ error[E0038]: the trait `Array` cannot be made into an object
   --> $DIR/issue-20692.rs:7:5
    |
 LL | trait Array: Sized + Copy {}
-   |              -----   ---- traits that require `Self: Sized` cannot be made into an object
-   |              |
-   |              traits that require `Self: Sized` cannot be made into an object
+   |       -----  -----   ---- ...because it requires `Self: Sized`
+   |       |      |
+   |       |      ...because it requires `Self: Sized`
+   |       this trait cannot be made into an object...
 ...
 LL |     &dyn Array;
    |     ^^^^^^^^^^ the trait `Array` cannot be made into an object
@@ -13,9 +14,10 @@ error[E0038]: the trait `Array` cannot be made into an object
   --> $DIR/issue-20692.rs:4:13
    |
 LL | trait Array: Sized + Copy {}
-   |              -----   ---- traits that require `Self: Sized` cannot be made into an object
-   |              |
-   |              traits that require `Self: Sized` cannot be made into an object
+   |       -----  -----   ---- ...because it requires `Self: Sized`
+   |       |      |
+   |       |      ...because it requires `Self: Sized`
+   |       this trait cannot be made into an object...
 ...
 LL |     let _ = x
    |             ^ the trait `Array` cannot be made into an object
diff --git a/src/test/ui/issues/issue-26056.stderr b/src/test/ui/issues/issue-26056.stderr
index 9c4cf0b18ac..2744fb91d6f 100644
--- a/src/test/ui/issues/issue-26056.stderr
+++ b/src/test/ui/issues/issue-26056.stderr
@@ -4,7 +4,7 @@ error[E0038]: the trait `Map` cannot be made into an object
 LL |         as &dyn Map<Key=u32,MapValue=u32>;
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Map` cannot be made into an object
    |
-   = note: the trait cannot use `Self` as a type parameter in the supertraits or where-clauses
+   = note: the trait cannot be made into an object because it cannot use `Self` as a type parameter in the supertraits or `where`-clauses
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/issues/issue-28576.stderr b/src/test/ui/issues/issue-28576.stderr
index 3249d76e69b..5bed9a77d18 100644
--- a/src/test/ui/issues/issue-28576.stderr
+++ b/src/test/ui/issues/issue-28576.stderr
@@ -5,7 +5,7 @@ LL | /            dyn Bar
 LL | |               <Assoc=()>
    | |________________________^ the trait `Bar` cannot be made into an object
    |
-   = note: the trait cannot use `Self` as a type parameter in the supertraits or where-clauses
+   = note: the trait cannot be made into an object because it cannot use `Self` as a type parameter in the supertraits or `where`-clauses
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/issues/issue-38404.stderr b/src/test/ui/issues/issue-38404.stderr
index d18a26b3a76..613888758ca 100644
--- a/src/test/ui/issues/issue-38404.stderr
+++ b/src/test/ui/issues/issue-38404.stderr
@@ -4,7 +4,7 @@ error[E0038]: the trait `B` cannot be made into an object
 LL | trait C<T>: A<dyn B<T, Output=usize>> {}
    |               ^^^^^^^^^^^^^^^^^^^^^^ the trait `B` cannot be made into an object
    |
-   = note: the trait cannot use `Self` as a type parameter in the supertraits or where-clauses
+   = note: the trait cannot be made into an object because it cannot use `Self` as a type parameter in the supertraits or `where`-clauses
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/issues/issue-38604.stderr b/src/test/ui/issues/issue-38604.stderr
index 8b923a2c6b2..b3ad71e174a 100644
--- a/src/test/ui/issues/issue-38604.stderr
+++ b/src/test/ui/issues/issue-38604.stderr
@@ -4,7 +4,7 @@ error[E0038]: the trait `Foo` cannot be made into an object
 LL |     let _f: Box<dyn Foo> =
    |             ^^^^^^^^^^^^ the trait `Foo` cannot be made into an object
    |
-   = note: the trait cannot use `Self` as a type parameter in the supertraits or where-clauses
+   = note: the trait cannot be made into an object because it cannot use `Self` as a type parameter in the supertraits or `where`-clauses
 
 error[E0038]: the trait `Foo` cannot be made into an object
   --> $DIR/issue-38604.rs:15:9
@@ -12,7 +12,7 @@ error[E0038]: the trait `Foo` cannot be made into an object
 LL |         Box::new(());
    |         ^^^^^^^^^^^^ the trait `Foo` cannot be made into an object
    |
-   = note: the trait cannot use `Self` as a type parameter in the supertraits or where-clauses
+   = note: the trait cannot be made into an object because it cannot use `Self` as a type parameter in the supertraits or `where`-clauses
    = note: required because of the requirements on the impl of `std::ops::CoerceUnsized<std::boxed::Box<dyn Foo>>` for `std::boxed::Box<()>`
    = note: required by cast to type `std::boxed::Box<dyn Foo>`
 
diff --git a/src/test/ui/issues/issue-50781.stderr b/src/test/ui/issues/issue-50781.stderr
index c161e9efd12..03e3a7f227a 100644
--- a/src/test/ui/issues/issue-50781.stderr
+++ b/src/test/ui/issues/issue-50781.stderr
@@ -1,8 +1,10 @@
 error: the trait `X` cannot be made into an object
   --> $DIR/issue-50781.rs:6:8
    |
+LL | trait X {
+   |       - this trait cannot be made into an object...
 LL |     fn foo(&self) where Self: Trait;
-   |        ^^^ method `foo` references the `Self` type in where clauses
+   |        ^^^ ...because method `foo` references the `Self` type in its `where` clause
    |
 note: the lint level is defined here
   --> $DIR/issue-50781.rs:1:9
@@ -11,6 +13,7 @@ LL | #![deny(where_clauses_object_safety)]
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
    = note: for more information, see issue #51443 <https://github.com/rust-lang/rust/issues/51443>
+   = help: consider moving `foo` to another trait
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/kindck/kindck-inherited-copy-bound.curr.stderr b/src/test/ui/kindck/kindck-inherited-copy-bound.curr.stderr
index 728a5ea6faa..2a9fd13be5f 100644
--- a/src/test/ui/kindck/kindck-inherited-copy-bound.curr.stderr
+++ b/src/test/ui/kindck/kindck-inherited-copy-bound.curr.stderr
@@ -13,7 +13,9 @@ error[E0038]: the trait `Foo` cannot be made into an object
   --> $DIR/kindck-inherited-copy-bound.rs:28:19
    |
 LL | trait Foo : Copy {
-   |             ---- traits that require `Self: Sized` cannot be made into an object
+   |       ---   ---- ...because it requires `Self: Sized`
+   |       |
+   |       this trait cannot be made into an object...
 ...
 LL |     let z = &x as &dyn Foo;
    |                   ^^^^^^^^ the trait `Foo` cannot be made into an object
@@ -22,7 +24,9 @@ error[E0038]: the trait `Foo` cannot be made into an object
   --> $DIR/kindck-inherited-copy-bound.rs:28:13
    |
 LL | trait Foo : Copy {
-   |             ---- traits that require `Self: Sized` cannot be made into an object
+   |       ---   ---- ...because it requires `Self: Sized`
+   |       |
+   |       this trait cannot be made into an object...
 ...
 LL |     let z = &x as &dyn Foo;
    |             ^^ the trait `Foo` cannot be made into an object
diff --git a/src/test/ui/kindck/kindck-inherited-copy-bound.object_safe_for_dispatch.stderr b/src/test/ui/kindck/kindck-inherited-copy-bound.object_safe_for_dispatch.stderr
index b4fba9706bc..6227ada4dc9 100644
--- a/src/test/ui/kindck/kindck-inherited-copy-bound.object_safe_for_dispatch.stderr
+++ b/src/test/ui/kindck/kindck-inherited-copy-bound.object_safe_for_dispatch.stderr
@@ -13,7 +13,9 @@ error[E0038]: the trait `Foo` cannot be made into an object
   --> $DIR/kindck-inherited-copy-bound.rs:28:13
    |
 LL | trait Foo : Copy {
-   |             ---- traits that require `Self: Sized` cannot be made into an object
+   |       ---   ---- ...because it requires `Self: Sized`
+   |       |
+   |       this trait cannot be made into an object...
 ...
 LL |     let z = &x as &dyn Foo;
    |             ^^ the trait `Foo` cannot be made into an object
diff --git a/src/test/ui/object-safety/object-safety-associated-consts.curr.stderr b/src/test/ui/object-safety/object-safety-associated-consts.curr.stderr
index b67b0e4f40e..e0e0344af75 100644
--- a/src/test/ui/object-safety/object-safety-associated-consts.curr.stderr
+++ b/src/test/ui/object-safety/object-safety-associated-consts.curr.stderr
@@ -1,11 +1,15 @@
 error[E0038]: the trait `Bar` cannot be made into an object
   --> $DIR/object-safety-associated-consts.rs:12:30
    |
+LL | trait Bar {
+   |       --- this trait cannot be made into an object...
 LL |     const X: usize;
-   |           - the trait cannot contain associated consts like `X`
+   |           - ...because it cannot contain associated consts like `X`
 ...
 LL | fn make_bar<T:Bar>(t: &T) -> &dyn Bar {
    |                              ^^^^^^^^ the trait `Bar` cannot be made into an object
+   |
+   = help: consider moving `X` to another trait
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/object-safety/object-safety-associated-consts.object_safe_for_dispatch.stderr b/src/test/ui/object-safety/object-safety-associated-consts.object_safe_for_dispatch.stderr
index 20993a680ba..ff0bd17dccc 100644
--- a/src/test/ui/object-safety/object-safety-associated-consts.object_safe_for_dispatch.stderr
+++ b/src/test/ui/object-safety/object-safety-associated-consts.object_safe_for_dispatch.stderr
@@ -1,12 +1,15 @@
 error[E0038]: the trait `Bar` cannot be made into an object
   --> $DIR/object-safety-associated-consts.rs:14:5
    |
+LL | trait Bar {
+   |       --- this trait cannot be made into an object...
 LL |     const X: usize;
-   |           - the trait cannot contain associated consts like `X`
+   |           - ...because it cannot contain associated consts like `X`
 ...
 LL |     t
    |     ^ the trait `Bar` cannot be made into an object
    |
+   = help: consider moving `X` to another trait
    = note: required because of the requirements on the impl of `std::ops::CoerceUnsized<&dyn Bar>` for `&T`
    = note: required by cast to type `&dyn Bar`
 
diff --git a/src/test/ui/object-safety/object-safety-generics.curr.stderr b/src/test/ui/object-safety/object-safety-generics.curr.stderr
index 2469467f084..9e70abbd32f 100644
--- a/src/test/ui/object-safety/object-safety-generics.curr.stderr
+++ b/src/test/ui/object-safety/object-safety-generics.curr.stderr
@@ -1,20 +1,28 @@
 error[E0038]: the trait `Bar` cannot be made into an object
   --> $DIR/object-safety-generics.rs:18:30
    |
+LL | trait Bar {
+   |       --- this trait cannot be made into an object...
 LL |     fn bar<T>(&self, t: T);
-   |        --- method `bar` has generic type parameters
+   |        --- ...because method `bar` has generic type parameters
 ...
 LL | fn make_bar<T:Bar>(t: &T) -> &dyn Bar {
    |                              ^^^^^^^^ the trait `Bar` cannot be made into an object
+   |
+   = help: consider moving `bar` to another trait
 
 error[E0038]: the trait `Bar` cannot be made into an object
   --> $DIR/object-safety-generics.rs:24:39
    |
+LL | trait Bar {
+   |       --- this trait cannot be made into an object...
 LL |     fn bar<T>(&self, t: T);
-   |        --- method `bar` has generic type parameters
+   |        --- ...because method `bar` has generic type parameters
 ...
 LL | fn make_bar_explicit<T:Bar>(t: &T) -> &dyn Bar {
    |                                       ^^^^^^^^ the trait `Bar` cannot be made into an object
+   |
+   = help: consider moving `bar` to another trait
 
 error: aborting due to 2 previous errors
 
diff --git a/src/test/ui/object-safety/object-safety-generics.object_safe_for_dispatch.stderr b/src/test/ui/object-safety/object-safety-generics.object_safe_for_dispatch.stderr
index d3d8d368888..7443d38470c 100644
--- a/src/test/ui/object-safety/object-safety-generics.object_safe_for_dispatch.stderr
+++ b/src/test/ui/object-safety/object-safety-generics.object_safe_for_dispatch.stderr
@@ -1,24 +1,30 @@
 error[E0038]: the trait `Bar` cannot be made into an object
   --> $DIR/object-safety-generics.rs:20:5
    |
+LL | trait Bar {
+   |       --- this trait cannot be made into an object...
 LL |     fn bar<T>(&self, t: T);
-   |        --- method `bar` has generic type parameters
+   |        --- ...because method `bar` has generic type parameters
 ...
 LL |     t
    |     ^ the trait `Bar` cannot be made into an object
    |
+   = help: consider moving `bar` to another trait
    = note: required because of the requirements on the impl of `std::ops::CoerceUnsized<&dyn Bar>` for `&T`
    = note: required by cast to type `&dyn Bar`
 
 error[E0038]: the trait `Bar` cannot be made into an object
   --> $DIR/object-safety-generics.rs:26:5
    |
+LL | trait Bar {
+   |       --- this trait cannot be made into an object...
 LL |     fn bar<T>(&self, t: T);
-   |        --- method `bar` has generic type parameters
+   |        --- ...because method `bar` has generic type parameters
 ...
 LL |     t as &dyn Bar
    |     ^ the trait `Bar` cannot be made into an object
    |
+   = help: consider moving `bar` to another trait
    = note: required because of the requirements on the impl of `std::ops::CoerceUnsized<&dyn Bar>` for `&T`
    = note: required by cast to type `&dyn Bar`
 
diff --git a/src/test/ui/object-safety/object-safety-issue-22040.stderr b/src/test/ui/object-safety/object-safety-issue-22040.stderr
index 1f5c472ddc2..55baf69401b 100644
--- a/src/test/ui/object-safety/object-safety-issue-22040.stderr
+++ b/src/test/ui/object-safety/object-safety-issue-22040.stderr
@@ -4,7 +4,7 @@ error[E0038]: the trait `Expr` cannot be made into an object
 LL |     elements: Vec<Box<dyn Expr + 'x>>,
    |                       ^^^^^^^^^^^^^ the trait `Expr` cannot be made into an object
    |
-   = note: the trait cannot use `Self` as a type parameter in the supertraits or where-clauses
+   = note: the trait cannot be made into an object because it cannot use `Self` as a type parameter in the supertraits or `where`-clauses
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/object-safety/object-safety-mentions-Self.curr.stderr b/src/test/ui/object-safety/object-safety-mentions-Self.curr.stderr
index 2123e306b16..e90f9b6d0a0 100644
--- a/src/test/ui/object-safety/object-safety-mentions-Self.curr.stderr
+++ b/src/test/ui/object-safety/object-safety-mentions-Self.curr.stderr
@@ -1,20 +1,28 @@
 error[E0038]: the trait `Bar` cannot be made into an object
   --> $DIR/object-safety-mentions-Self.rs:22:30
    |
+LL | trait Bar {
+   |       --- this trait cannot be made into an object...
 LL |     fn bar(&self, x: &Self);
-   |        --- method `bar` references the `Self` type in its parameters or return type
+   |        --- ...because method `bar` references the `Self` type in its parameters or return type
 ...
 LL | fn make_bar<T:Bar>(t: &T) -> &dyn Bar {
    |                              ^^^^^^^^ the trait `Bar` cannot be made into an object
+   |
+   = help: consider moving `bar` to another trait
 
 error[E0038]: the trait `Baz` cannot be made into an object
   --> $DIR/object-safety-mentions-Self.rs:28:30
    |
+LL | trait Baz {
+   |       --- this trait cannot be made into an object...
 LL |     fn baz(&self) -> Self;
-   |        --- method `baz` references the `Self` type in its parameters or return type
+   |        --- ...because method `baz` references the `Self` type in its parameters or return type
 ...
 LL | fn make_baz<T:Baz>(t: &T) -> &dyn Baz {
    |                              ^^^^^^^^ the trait `Baz` cannot be made into an object
+   |
+   = help: consider moving `baz` to another trait
 
 error: aborting due to 2 previous errors
 
diff --git a/src/test/ui/object-safety/object-safety-mentions-Self.object_safe_for_dispatch.stderr b/src/test/ui/object-safety/object-safety-mentions-Self.object_safe_for_dispatch.stderr
index 03b2b8da075..4a23fb56e91 100644
--- a/src/test/ui/object-safety/object-safety-mentions-Self.object_safe_for_dispatch.stderr
+++ b/src/test/ui/object-safety/object-safety-mentions-Self.object_safe_for_dispatch.stderr
@@ -1,24 +1,30 @@
 error[E0038]: the trait `Bar` cannot be made into an object
   --> $DIR/object-safety-mentions-Self.rs:24:5
    |
+LL | trait Bar {
+   |       --- this trait cannot be made into an object...
 LL |     fn bar(&self, x: &Self);
-   |        --- method `bar` references the `Self` type in its parameters or return type
+   |        --- ...because method `bar` references the `Self` type in its parameters or return type
 ...
 LL |     t
    |     ^ the trait `Bar` cannot be made into an object
    |
+   = help: consider moving `bar` to another trait
    = note: required because of the requirements on the impl of `std::ops::CoerceUnsized<&dyn Bar>` for `&T`
    = note: required by cast to type `&dyn Bar`
 
 error[E0038]: the trait `Baz` cannot be made into an object
   --> $DIR/object-safety-mentions-Self.rs:30:5
    |
+LL | trait Baz {
+   |       --- this trait cannot be made into an object...
 LL |     fn baz(&self) -> Self;
-   |        --- method `baz` references the `Self` type in its parameters or return type
+   |        --- ...because method `baz` references the `Self` type in its parameters or return type
 ...
 LL |     t
    |     ^ the trait `Baz` cannot be made into an object
    |
+   = help: consider moving `baz` to another trait
    = note: required because of the requirements on the impl of `std::ops::CoerceUnsized<&dyn Baz>` for `&T`
    = note: required by cast to type `&dyn Baz`
 
diff --git a/src/test/ui/object-safety/object-safety-no-static.curr.stderr b/src/test/ui/object-safety/object-safety-no-static.curr.stderr
index 099876c562a..2f79d53d1c1 100644
--- a/src/test/ui/object-safety/object-safety-no-static.curr.stderr
+++ b/src/test/ui/object-safety/object-safety-no-static.curr.stderr
@@ -1,11 +1,15 @@
 error[E0038]: the trait `Foo` cannot be made into an object
   --> $DIR/object-safety-no-static.rs:12:18
    |
+LL | trait Foo {
+   |       --- this trait cannot be made into an object...
 LL |     fn foo() {}
-   |        --- associated function `foo` has no `self` parameter
+   |        --- ...because associated function `foo` has no `self` parameter
 ...
 LL | fn diverges() -> Box<dyn Foo> {
    |                  ^^^^^^^^^^^^ the trait `Foo` cannot be made into an object
+   |
+   = help: consider turning `foo` into a method by giving it a `&self` argument or constraining it with `where Self: Sized`
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/object-safety/object-safety-no-static.object_safe_for_dispatch.stderr b/src/test/ui/object-safety/object-safety-no-static.object_safe_for_dispatch.stderr
index 91a9285b63c..bed6757fc68 100644
--- a/src/test/ui/object-safety/object-safety-no-static.object_safe_for_dispatch.stderr
+++ b/src/test/ui/object-safety/object-safety-no-static.object_safe_for_dispatch.stderr
@@ -1,12 +1,15 @@
 error[E0038]: the trait `Foo` cannot be made into an object
   --> $DIR/object-safety-no-static.rs:22:27
    |
+LL | trait Foo {
+   |       --- this trait cannot be made into an object...
 LL |     fn foo() {}
-   |        --- associated function `foo` has no `self` parameter
+   |        --- ...because associated function `foo` has no `self` parameter
 ...
 LL |     let b: Box<dyn Foo> = Box::new(Bar);
    |                           ^^^^^^^^^^^^^ the trait `Foo` cannot be made into an object
    |
+   = help: consider turning `foo` into a method by giving it a `&self` argument or constraining it with `where Self: Sized`
    = note: required because of the requirements on the impl of `std::ops::CoerceUnsized<std::boxed::Box<dyn Foo>>` for `std::boxed::Box<Bar>`
    = note: required by cast to type `std::boxed::Box<dyn Foo>`
 
diff --git a/src/test/ui/object-safety/object-safety-sized-2.curr.stderr b/src/test/ui/object-safety/object-safety-sized-2.curr.stderr
index 49f98e00850..2f605d8e904 100644
--- a/src/test/ui/object-safety/object-safety-sized-2.curr.stderr
+++ b/src/test/ui/object-safety/object-safety-sized-2.curr.stderr
@@ -1,8 +1,10 @@
 error[E0038]: the trait `Bar` cannot be made into an object
   --> $DIR/object-safety-sized-2.rs:14:30
    |
+LL | trait Bar
+   |       --- this trait cannot be made into an object...
 LL |     where Self : Sized
-   |                  ----- traits that require `Self: Sized` cannot be made into an object
+   |                  ----- ...because it requires `Self: Sized`
 ...
 LL | fn make_bar<T:Bar>(t: &T) -> &dyn Bar {
    |                              ^^^^^^^^ the trait `Bar` cannot be made into an object
diff --git a/src/test/ui/object-safety/object-safety-sized-2.object_safe_for_dispatch.stderr b/src/test/ui/object-safety/object-safety-sized-2.object_safe_for_dispatch.stderr
index 9b189c48f93..2f1f06f4cf5 100644
--- a/src/test/ui/object-safety/object-safety-sized-2.object_safe_for_dispatch.stderr
+++ b/src/test/ui/object-safety/object-safety-sized-2.object_safe_for_dispatch.stderr
@@ -1,8 +1,10 @@
 error[E0038]: the trait `Bar` cannot be made into an object
   --> $DIR/object-safety-sized-2.rs:16:5
    |
+LL | trait Bar
+   |       --- this trait cannot be made into an object...
 LL |     where Self : Sized
-   |                  ----- traits that require `Self: Sized` cannot be made into an object
+   |                  ----- ...because it requires `Self: Sized`
 ...
 LL |     t
    |     ^ the trait `Bar` cannot be made into an object
diff --git a/src/test/ui/object-safety/object-safety-sized.curr.stderr b/src/test/ui/object-safety/object-safety-sized.curr.stderr
index 3b588034e33..54f65c43d9c 100644
--- a/src/test/ui/object-safety/object-safety-sized.curr.stderr
+++ b/src/test/ui/object-safety/object-safety-sized.curr.stderr
@@ -2,7 +2,9 @@ error[E0038]: the trait `Bar` cannot be made into an object
   --> $DIR/object-safety-sized.rs:12:30
    |
 LL | trait Bar : Sized {
-   |             ----- traits that require `Self: Sized` cannot be made into an object
+   |       ---   ----- ...because it requires `Self: Sized`
+   |       |
+   |       this trait cannot be made into an object...
 ...
 LL | fn make_bar<T:Bar>(t: &T) -> &dyn Bar {
    |                              ^^^^^^^^ the trait `Bar` cannot be made into an object
diff --git a/src/test/ui/object-safety/object-safety-sized.object_safe_for_dispatch.stderr b/src/test/ui/object-safety/object-safety-sized.object_safe_for_dispatch.stderr
index 6b60eef30d3..58c2b772147 100644
--- a/src/test/ui/object-safety/object-safety-sized.object_safe_for_dispatch.stderr
+++ b/src/test/ui/object-safety/object-safety-sized.object_safe_for_dispatch.stderr
@@ -2,7 +2,9 @@ error[E0038]: the trait `Bar` cannot be made into an object
   --> $DIR/object-safety-sized.rs:14:5
    |
 LL | trait Bar : Sized {
-   |             ----- traits that require `Self: Sized` cannot be made into an object
+   |       ---   ----- ...because it requires `Self: Sized`
+   |       |
+   |       this trait cannot be made into an object...
 ...
 LL |     t
    |     ^ the trait `Bar` cannot be made into an object
diff --git a/src/test/ui/object-safety/object-safety-supertrait-mentions-Self.stderr b/src/test/ui/object-safety/object-safety-supertrait-mentions-Self.stderr
index 8ae89832703..04f630d5dac 100644
--- a/src/test/ui/object-safety/object-safety-supertrait-mentions-Self.stderr
+++ b/src/test/ui/object-safety/object-safety-supertrait-mentions-Self.stderr
@@ -4,7 +4,7 @@ error[E0038]: the trait `Baz` cannot be made into an object
 LL | fn make_baz<T:Baz>(t: &T) -> &dyn Baz {
    |                               ^^^^^^^ the trait `Baz` cannot be made into an object
    |
-   = note: the trait cannot use `Self` as a type parameter in the supertraits or where-clauses
+   = note: the trait cannot be made into an object because it cannot use `Self` as a type parameter in the supertraits or `where`-clauses
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/resolve/issue-3907-2.stderr b/src/test/ui/resolve/issue-3907-2.stderr
index 1d6b378b9c8..d0c278d12d7 100644
--- a/src/test/ui/resolve/issue-3907-2.stderr
+++ b/src/test/ui/resolve/issue-3907-2.stderr
@@ -4,7 +4,7 @@ error[E0038]: the trait `issue_3907::Foo` cannot be made into an object
 LL | fn bar(_x: Foo) {}
    |            ^^^ the trait `issue_3907::Foo` cannot be made into an object
    |
-   = note: associated function `bar` has no `self` parameter
+   = note: the trait cannot be made into an object because associated function `bar` has no `self` parameter
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/self/arbitrary-self-types-not-object-safe.curr.stderr b/src/test/ui/self/arbitrary-self-types-not-object-safe.curr.stderr
index 653ccb9db94..c06538fae3b 100644
--- a/src/test/ui/self/arbitrary-self-types-not-object-safe.curr.stderr
+++ b/src/test/ui/self/arbitrary-self-types-not-object-safe.curr.stderr
@@ -1,21 +1,28 @@
 error[E0038]: the trait `Foo` cannot be made into an object
   --> $DIR/arbitrary-self-types-not-object-safe.rs:33:32
    |
+LL | trait Foo {
+   |       --- this trait cannot be made into an object...
 LL |     fn foo(self: &Rc<Self>) -> usize;
-   |        --- method `foo`'s `self` parameter cannot be dispatched on
+   |        --- ...because method `foo`'s `self` parameter cannot be dispatched on
 ...
 LL |     let x = Rc::new(5usize) as Rc<dyn Foo>;
    |                                ^^^^^^^^^^^ the trait `Foo` cannot be made into an object
+   |
+   = help: consider changing method `foo`'s `self` parameter to be `&self`
 
 error[E0038]: the trait `Foo` cannot be made into an object
   --> $DIR/arbitrary-self-types-not-object-safe.rs:33:13
    |
+LL | trait Foo {
+   |       --- this trait cannot be made into an object...
 LL |     fn foo(self: &Rc<Self>) -> usize;
-   |        --- method `foo`'s `self` parameter cannot be dispatched on
+   |        --- ...because method `foo`'s `self` parameter cannot be dispatched on
 ...
 LL |     let x = Rc::new(5usize) as Rc<dyn Foo>;
    |             ^^^^^^^^^^^^^^^ the trait `Foo` cannot be made into an object
    |
+   = help: consider changing method `foo`'s `self` parameter to be `&self`
    = note: required because of the requirements on the impl of `std::ops::CoerceUnsized<std::rc::Rc<dyn Foo>>` for `std::rc::Rc<usize>`
    = note: required by cast to type `std::rc::Rc<dyn Foo>`
 
diff --git a/src/test/ui/self/arbitrary-self-types-not-object-safe.object_safe_for_dispatch.stderr b/src/test/ui/self/arbitrary-self-types-not-object-safe.object_safe_for_dispatch.stderr
index 33f1fa2e51b..bebd5cbcf78 100644
--- a/src/test/ui/self/arbitrary-self-types-not-object-safe.object_safe_for_dispatch.stderr
+++ b/src/test/ui/self/arbitrary-self-types-not-object-safe.object_safe_for_dispatch.stderr
@@ -1,12 +1,15 @@
 error[E0038]: the trait `Foo` cannot be made into an object
   --> $DIR/arbitrary-self-types-not-object-safe.rs:33:13
    |
+LL | trait Foo {
+   |       --- this trait cannot be made into an object...
 LL |     fn foo(self: &Rc<Self>) -> usize;
-   |        --- method `foo`'s `self` parameter cannot be dispatched on
+   |        --- ...because method `foo`'s `self` parameter cannot be dispatched on
 ...
 LL |     let x = Rc::new(5usize) as Rc<dyn Foo>;
    |             ^^^^^^^^^^^^^^^ the trait `Foo` cannot be made into an object
    |
+   = help: consider changing method `foo`'s `self` parameter to be `&self`
    = note: required because of the requirements on the impl of `std::ops::CoerceUnsized<std::rc::Rc<dyn Foo>>` for `std::rc::Rc<usize>`
    = note: required by cast to type `std::rc::Rc<dyn Foo>`
 
diff --git a/src/test/ui/suggestions/object-unsafe-trait-should-use-self.stderr b/src/test/ui/suggestions/object-unsafe-trait-should-use-self.stderr
index 4a9242b1f4f..55185a2c8cd 100644
--- a/src/test/ui/suggestions/object-unsafe-trait-should-use-self.stderr
+++ b/src/test/ui/suggestions/object-unsafe-trait-should-use-self.stderr
@@ -15,7 +15,9 @@ error[E0038]: the trait `A` cannot be made into an object
   --> $DIR/object-unsafe-trait-should-use-self.rs:3:13
    |
 LL | trait A: Sized {
-   |          ----- traits that require `Self: Sized` cannot be made into an object
+   |       -  ----- ...because it requires `Self: Sized`
+   |       |
+   |       this trait cannot be made into an object...
 LL |     fn f(a: A) -> A;
    |             ^ the trait `A` cannot be made into an object
 
@@ -35,10 +37,14 @@ LL |     fn f(a: Self) -> Self;
 error[E0038]: the trait `B` cannot be made into an object
   --> $DIR/object-unsafe-trait-should-use-self.rs:8:13
    |
+LL | trait B {
+   |       - this trait cannot be made into an object...
 LL |     fn f(a: B) -> B;
    |        -    ^ the trait `B` cannot be made into an object
    |        |
-   |        associated function `f` has no `self` parameter
+   |        ...because associated function `f` has no `self` parameter
+   |
+   = help: consider turning `f` into a method by giving it a `&self` argument or constraining it with `where Self: Sized`
 
 error: aborting due to 4 previous errors
 
diff --git a/src/test/ui/traits/trait-alias/trait-alias-object-fail.stderr b/src/test/ui/traits/trait-alias/trait-alias-object-fail.stderr
index 5551b1303b9..1f9ffb6a4cf 100644
--- a/src/test/ui/traits/trait-alias/trait-alias-object-fail.stderr
+++ b/src/test/ui/traits/trait-alias/trait-alias-object-fail.stderr
@@ -4,7 +4,7 @@ error[E0038]: the trait `std::cmp::Eq` cannot be made into an object
 LL |     let _: &dyn EqAlias = &123;
    |             ^^^^^^^^^^^ the trait `std::cmp::Eq` cannot be made into an object
    |
-   = note: the trait cannot use `Self` as a type parameter in the supertraits or where-clauses
+   = note: the trait cannot be made into an object because it cannot use `Self` as a type parameter in the supertraits or `where`-clauses
 
 error[E0191]: the value of the associated type `Item` (from trait `std::iter::Iterator`) must be specified
   --> $DIR/trait-alias-object-fail.rs:9:17
diff --git a/src/test/ui/traits/trait-item-privacy.stderr b/src/test/ui/traits/trait-item-privacy.stderr
index 4df8845de27..e050d6940ab 100644
--- a/src/test/ui/traits/trait-item-privacy.stderr
+++ b/src/test/ui/traits/trait-item-privacy.stderr
@@ -111,16 +111,22 @@ error[E0038]: the trait `assoc_const::C` cannot be made into an object
   --> $DIR/trait-item-privacy.rs:101:5
    |
 LL |         const A: u8 = 0;
-   |               - the trait cannot contain associated consts like `A`
+   |               - ...because it cannot contain associated consts like `A`
 ...
 LL |         const B: u8 = 0;
-   |               - the trait cannot contain associated consts like `B`
+   |               - ...because it cannot contain associated consts like `B`
 ...
+LL |     pub trait C: A + B {
+   |               - this trait cannot be made into an object...
 LL |         const C: u8 = 0;
-   |               - the trait cannot contain associated consts like `C`
+   |               - ...because it cannot contain associated consts like `C`
 ...
 LL |     C::A;
    |     ^^^^ the trait `assoc_const::C` cannot be made into an object
+   |
+   = help: consider moving `C` to another trait
+   = help: consider moving `B` to another trait
+   = help: consider moving `A` to another trait
 
 error[E0223]: ambiguous associated type
   --> $DIR/trait-item-privacy.rs:115:12
diff --git a/src/test/ui/traits/trait-object-macro-matcher.stderr b/src/test/ui/traits/trait-object-macro-matcher.stderr
index f41ebf4166d..a8511f63c16 100644
--- a/src/test/ui/traits/trait-object-macro-matcher.stderr
+++ b/src/test/ui/traits/trait-object-macro-matcher.stderr
@@ -10,7 +10,7 @@ error[E0038]: the trait `std::marker::Copy` cannot be made into an object
 LL |     m!(dyn Copy + Send + 'static);
    |        ^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` cannot be made into an object
    |
-   = note: traits that require `Self: Sized` cannot be made into an object
+   = note: the trait cannot be made into an object because it requires `Self: Sized`
 
 error: aborting due to 2 previous errors
 
diff --git a/src/test/ui/traits/trait-object-safety.stderr b/src/test/ui/traits/trait-object-safety.stderr
index 028e9eedd64..5eb8cd0d806 100644
--- a/src/test/ui/traits/trait-object-safety.stderr
+++ b/src/test/ui/traits/trait-object-safety.stderr
@@ -1,23 +1,30 @@
 error[E0038]: the trait `Tr` cannot be made into an object
   --> $DIR/trait-object-safety.rs:15:22
    |
+LL | trait Tr {
+   |       -- this trait cannot be made into an object...
 LL |     fn foo();
-   |        --- associated function `foo` has no `self` parameter
+   |        --- ...because associated function `foo` has no `self` parameter
 ...
 LL |     let _: &dyn Tr = &St;
    |                      ^^^ the trait `Tr` cannot be made into an object
    |
+   = help: consider turning `foo` into a method by giving it a `&self` argument or constraining it with `where Self: Sized`
    = note: required because of the requirements on the impl of `std::ops::CoerceUnsized<&dyn Tr>` for `&St`
    = note: required by cast to type `&dyn Tr`
 
 error[E0038]: the trait `Tr` cannot be made into an object
   --> $DIR/trait-object-safety.rs:15:12
    |
+LL | trait Tr {
+   |       -- this trait cannot be made into an object...
 LL |     fn foo();
-   |        --- associated function `foo` has no `self` parameter
+   |        --- ...because associated function `foo` has no `self` parameter
 ...
 LL |     let _: &dyn Tr = &St;
    |            ^^^^^^^ the trait `Tr` cannot be made into an object
+   |
+   = help: consider turning `foo` into a method by giving it a `&self` argument or constraining it with `where Self: Sized`
 
 error: aborting due to 2 previous errors
 
diff --git a/src/test/ui/traits/trait-test-2.stderr b/src/test/ui/traits/trait-test-2.stderr
index 9b750d382ec..5b2b7b51f3d 100644
--- a/src/test/ui/traits/trait-test-2.stderr
+++ b/src/test/ui/traits/trait-test-2.stderr
@@ -14,24 +14,31 @@ error[E0038]: the trait `bar` cannot be made into an object
   --> $DIR/trait-test-2.rs:11:16
    |
 LL | trait bar { fn dup(&self) -> Self; fn blah<X>(&self); }
-   |                ---                    ---- method `blah` has generic type parameters
-   |                |
-   |                method `dup` references the `Self` type in its parameters or return type
+   |       ---      ---                    ---- ...because method `blah` has generic type parameters
+   |       |        |
+   |       |        ...because method `dup` references the `Self` type in its parameters or return type
+   |       this trait cannot be made into an object...
 ...
 LL |     (box 10 as Box<dyn bar>).dup();
    |                ^^^^^^^^^^^^ the trait `bar` cannot be made into an object
+   |
+   = help: consider moving `dup` to another trait
+   = help: consider moving `blah` to another trait
 
 error[E0038]: the trait `bar` cannot be made into an object
   --> $DIR/trait-test-2.rs:11:6
    |
 LL | trait bar { fn dup(&self) -> Self; fn blah<X>(&self); }
-   |                ---                    ---- method `blah` has generic type parameters
-   |                |
-   |                method `dup` references the `Self` type in its parameters or return type
+   |       ---      ---                    ---- ...because method `blah` has generic type parameters
+   |       |        |
+   |       |        ...because method `dup` references the `Self` type in its parameters or return type
+   |       this trait cannot be made into an object...
 ...
 LL |     (box 10 as Box<dyn bar>).dup();
    |      ^^^^^^ the trait `bar` cannot be made into an object
    |
+   = help: consider moving `dup` to another trait
+   = help: consider moving `blah` to another trait
    = note: required because of the requirements on the impl of `std::ops::CoerceUnsized<std::boxed::Box<dyn bar>>` for `std::boxed::Box<{integer}>`
    = note: required by cast to type `std::boxed::Box<dyn bar>`
 
diff --git a/src/test/ui/type/type-parameter-defaults-referencing-Self-ppaux.stderr b/src/test/ui/type/type-parameter-defaults-referencing-Self-ppaux.stderr
index b315fe9df8a..fa6c5a92fb4 100644
--- a/src/test/ui/type/type-parameter-defaults-referencing-Self-ppaux.stderr
+++ b/src/test/ui/type/type-parameter-defaults-referencing-Self-ppaux.stderr
@@ -14,10 +14,14 @@ error[E0038]: the trait `MyAdd` cannot be made into an object
   --> $DIR/type-parameter-defaults-referencing-Self-ppaux.rs:14:18
    |
 LL | trait MyAdd<Rhs=Self> { fn add(&self, other: &Rhs) -> Self; }
-   |                            --- method `add` references the `Self` type in its parameters or return type
+   |       -----                --- ...because method `add` references the `Self` type in its parameters or return type
+   |       |
+   |       this trait cannot be made into an object...
 ...
 LL |     let y = x as dyn MyAdd<i32>;
    |                  ^^^^^^^^^^^^^^ the trait `MyAdd` cannot be made into an object
+   |
+   = help: consider moving `add` to another trait
 
 error: aborting due to 2 previous errors
 
diff --git a/src/test/ui/wf/wf-convert-unsafe-trait-obj-box.stderr b/src/test/ui/wf/wf-convert-unsafe-trait-obj-box.stderr
index 7e055d746f6..eefb450155c 100644
--- a/src/test/ui/wf/wf-convert-unsafe-trait-obj-box.stderr
+++ b/src/test/ui/wf/wf-convert-unsafe-trait-obj-box.stderr
@@ -2,7 +2,9 @@ error[E0038]: the trait `Trait` cannot be made into an object
   --> $DIR/wf-convert-unsafe-trait-obj-box.rs:16:33
    |
 LL | trait Trait: Sized {}
-   |              ----- traits that require `Self: Sized` cannot be made into an object
+   |       -----  ----- ...because it requires `Self: Sized`
+   |       |
+   |       this trait cannot be made into an object...
 ...
 LL |     let t_box: Box<dyn Trait> = Box::new(S);
    |                                 ^^^^^^^^^^^ the trait `Trait` cannot be made into an object
@@ -14,7 +16,9 @@ error[E0038]: the trait `Trait` cannot be made into an object
   --> $DIR/wf-convert-unsafe-trait-obj-box.rs:17:15
    |
 LL | trait Trait: Sized {}
-   |              ----- traits that require `Self: Sized` cannot be made into an object
+   |       -----  ----- ...because it requires `Self: Sized`
+   |       |
+   |       this trait cannot be made into an object...
 ...
 LL |     takes_box(Box::new(S));
    |               ^^^^^^^^^^^ the trait `Trait` cannot be made into an object
@@ -26,7 +30,9 @@ error[E0038]: the trait `Trait` cannot be made into an object
   --> $DIR/wf-convert-unsafe-trait-obj-box.rs:15:5
    |
 LL | trait Trait: Sized {}
-   |              ----- traits that require `Self: Sized` cannot be made into an object
+   |       -----  ----- ...because it requires `Self: Sized`
+   |       |
+   |       this trait cannot be made into an object...
 ...
 LL |     Box::new(S) as Box<dyn Trait>;
    |     ^^^^^^^^^^^ the trait `Trait` cannot be made into an object
diff --git a/src/test/ui/wf/wf-convert-unsafe-trait-obj.stderr b/src/test/ui/wf/wf-convert-unsafe-trait-obj.stderr
index 9e7fe7f3e1d..5e645382d1b 100644
--- a/src/test/ui/wf/wf-convert-unsafe-trait-obj.stderr
+++ b/src/test/ui/wf/wf-convert-unsafe-trait-obj.stderr
@@ -2,7 +2,9 @@ error[E0038]: the trait `Trait` cannot be made into an object
   --> $DIR/wf-convert-unsafe-trait-obj.rs:16:25
    |
 LL | trait Trait: Sized {}
-   |              ----- traits that require `Self: Sized` cannot be made into an object
+   |       -----  ----- ...because it requires `Self: Sized`
+   |       |
+   |       this trait cannot be made into an object...
 ...
 LL |     let t: &dyn Trait = &S;
    |                         ^^ the trait `Trait` cannot be made into an object
@@ -14,7 +16,9 @@ error[E0038]: the trait `Trait` cannot be made into an object
   --> $DIR/wf-convert-unsafe-trait-obj.rs:17:17
    |
 LL | trait Trait: Sized {}
-   |              ----- traits that require `Self: Sized` cannot be made into an object
+   |       -----  ----- ...because it requires `Self: Sized`
+   |       |
+   |       this trait cannot be made into an object...
 ...
 LL |     takes_trait(&S);
    |                 ^^ the trait `Trait` cannot be made into an object
@@ -26,7 +30,9 @@ error[E0038]: the trait `Trait` cannot be made into an object
   --> $DIR/wf-convert-unsafe-trait-obj.rs:15:5
    |
 LL | trait Trait: Sized {}
-   |              ----- traits that require `Self: Sized` cannot be made into an object
+   |       -----  ----- ...because it requires `Self: Sized`
+   |       |
+   |       this trait cannot be made into an object...
 ...
 LL |     &S as &dyn Trait;
    |     ^^ the trait `Trait` cannot be made into an object
diff --git a/src/test/ui/wf/wf-fn-where-clause.stderr b/src/test/ui/wf/wf-fn-where-clause.stderr
index f17391520a3..1c530ece295 100644
--- a/src/test/ui/wf/wf-fn-where-clause.stderr
+++ b/src/test/ui/wf/wf-fn-where-clause.stderr
@@ -25,7 +25,7 @@ error[E0038]: the trait `std::marker::Copy` cannot be made into an object
 LL | fn bar() where Vec<dyn Copy>:, {}
    |                ^^^^^^^^^^^^^ the trait `std::marker::Copy` cannot be made into an object
    |
-   = note: traits that require `Self: Sized` cannot be made into an object
+   = note: the trait cannot be made into an object because it requires `Self: Sized`
 
 error: aborting due to 3 previous errors
 
diff --git a/src/test/ui/wf/wf-object-safe.stderr b/src/test/ui/wf/wf-object-safe.stderr
index 0d8441f87e7..2ff6383bc80 100644
--- a/src/test/ui/wf/wf-object-safe.stderr
+++ b/src/test/ui/wf/wf-object-safe.stderr
@@ -1,11 +1,15 @@
 error[E0038]: the trait `A` cannot be made into an object
   --> $DIR/wf-object-safe.rs:9:13
    |
+LL | trait A {
+   |       - this trait cannot be made into an object...
 LL |     fn foo(&self, _x: &Self);
-   |        --- method `foo` references the `Self` type in its parameters or return type
+   |        --- ...because method `foo` references the `Self` type in its parameters or return type
 ...
 LL |     let _x: &dyn A;
    |             ^^^^^^ the trait `A` cannot be made into an object
+   |
+   = help: consider moving `foo` to another trait
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/wf/wf-unsafe-trait-obj-match.stderr b/src/test/ui/wf/wf-unsafe-trait-obj-match.stderr
index 452a2a5e58b..9319e3382c2 100644
--- a/src/test/ui/wf/wf-unsafe-trait-obj-match.stderr
+++ b/src/test/ui/wf/wf-unsafe-trait-obj-match.stderr
@@ -16,7 +16,9 @@ error[E0038]: the trait `Trait` cannot be made into an object
   --> $DIR/wf-unsafe-trait-obj-match.rs:26:21
    |
 LL | trait Trait: Sized {}
-   |              ----- traits that require `Self: Sized` cannot be made into an object
+   |       -----  ----- ...because it requires `Self: Sized`
+   |       |
+   |       this trait cannot be made into an object...
 ...
 LL |         Some(()) => &S,
    |                     ^^ the trait `Trait` cannot be made into an object
@@ -28,7 +30,9 @@ error[E0038]: the trait `Trait` cannot be made into an object
   --> $DIR/wf-unsafe-trait-obj-match.rs:25:25
    |
 LL | trait Trait: Sized {}
-   |              ----- traits that require `Self: Sized` cannot be made into an object
+   |       -----  ----- ...because it requires `Self: Sized`
+   |       |
+   |       this trait cannot be made into an object...
 ...
 LL |     let t: &dyn Trait = match opt() {
    |                         ^^^^^^^^^^^ the trait `Trait` cannot be made into an object