about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2024-11-26 12:03:44 -0500
committerGitHub <noreply@github.com>2024-11-26 12:03:44 -0500
commitb0ed5ac730575b3453d1c24e1ebf9710abeff31f (patch)
treef2d3b8eaf6bb2cb56a86aa3b648a55f191c4b55d
parentcf097188763cdf883478b4c1f46813e0e7783caf (diff)
parentcfa8fcbf581c8c311e079b04517cbe979d9beb7b (diff)
downloadrust-b0ed5ac730575b3453d1c24e1ebf9710abeff31f.tar.gz
rust-b0ed5ac730575b3453d1c24e1ebf9710abeff31f.zip
Rollup merge of #133394 - compiler-errors:dyn-more-errors, r=lcnr
Bail on more errors in dyn ty lowering

If we have more than one principal trait, or if we have a principal trait with errors in it, then bail with `TyKind::Error` rather than attempting lowering. Lowering a dyn trait with more than one principal just arbitrarily chooses the first one and drops the subsequent ones, and lowering a dyn trait path with errors in it is just kinda useless.

This suppresses unnecessary errors which I think is net-good, but also is important to make sure that we don't end up leaking `{type error}` in https://github.com/rust-lang/rust/issues/133388 error messaging :)

r? types
-rw-r--r--compiler/rustc_hir_analysis/src/hir_ty_lowering/dyn_compatibility.rs20
-rw-r--r--tests/crashes/130521.rs2
-rw-r--r--tests/rustdoc-ui/unable-fulfill-trait.rs1
-rw-r--r--tests/rustdoc-ui/unable-fulfill-trait.stderr13
-rw-r--r--tests/ui/associated-types/issue-22560.rs5
-rw-r--r--tests/ui/associated-types/issue-22560.stderr54
-rw-r--r--tests/ui/associated-types/missing-associated-types.rs4
-rw-r--r--tests/ui/associated-types/missing-associated-types.stderr83
-rw-r--r--tests/ui/const-generics/not_wf_param_in_rpitit.rs3
-rw-r--r--tests/ui/const-generics/not_wf_param_in_rpitit.stderr76
-rw-r--r--tests/ui/issues/issue-23024.rs1
-rw-r--r--tests/ui/issues/issue-23024.stderr10
-rw-r--r--tests/ui/issues/issue-34373.rs1
-rw-r--r--tests/ui/issues/issue-34373.stderr30
-rw-r--r--tests/ui/suggestions/use-type-argument-instead-of-assoc-type.rs3
-rw-r--r--tests/ui/suggestions/use-type-argument-instead-of-assoc-type.stderr17
-rw-r--r--tests/ui/traits/bad-sized.rs3
-rw-r--r--tests/ui/traits/bad-sized.stderr35
-rw-r--r--tests/ui/traits/issue-32963.rs1
-rw-r--r--tests/ui/traits/issue-32963.stderr17
-rw-r--r--tests/ui/wf/ice-hir-wf-check-anon-const-issue-122199.rs8
-rw-r--r--tests/ui/wf/ice-hir-wf-check-anon-const-issue-122199.stderr129
22 files changed, 61 insertions, 455 deletions
diff --git a/compiler/rustc_hir_analysis/src/hir_ty_lowering/dyn_compatibility.rs b/compiler/rustc_hir_analysis/src/hir_ty_lowering/dyn_compatibility.rs
index 5e27ace4cbe..f6e227377b9 100644
--- a/compiler/rustc_hir_analysis/src/hir_ty_lowering/dyn_compatibility.rs
+++ b/compiler/rustc_hir_analysis/src/hir_ty_lowering/dyn_compatibility.rs
@@ -8,7 +8,8 @@ use rustc_lint_defs::builtin::UNUSED_ASSOCIATED_TYPE_BOUNDS;
 use rustc_middle::span_bug;
 use rustc_middle::ty::fold::BottomUpFolder;
 use rustc_middle::ty::{
-    self, DynKind, ExistentialPredicateStableCmpExt as _, Ty, TyCtxt, TypeFoldable, Upcast,
+    self, DynKind, ExistentialPredicateStableCmpExt as _, Ty, TyCtxt, TypeFoldable,
+    TypeVisitableExt, Upcast,
 };
 use rustc_span::{ErrorGuaranteed, Span};
 use rustc_trait_selection::error_reporting::traits::report_dyn_incompatibility;
@@ -92,11 +93,20 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
 
         let (mut auto_traits, regular_traits): (Vec<_>, Vec<_>) =
             expanded_traits.partition(|i| tcx.trait_is_auto(i.trait_ref().def_id()));
+
+        // We don't support >1 principal
         if regular_traits.len() > 1 {
-            let _ = self.report_trait_object_addition_traits_error(&regular_traits);
-        } else if regular_traits.is_empty() && auto_traits.is_empty() {
-            let reported = self.report_trait_object_with_no_traits_error(span, &trait_bounds);
-            return Ty::new_error(tcx, reported);
+            let guar = self.report_trait_object_addition_traits_error(&regular_traits);
+            return Ty::new_error(tcx, guar);
+        }
+        // We  don't support empty trait objects.
+        if regular_traits.is_empty() && auto_traits.is_empty() {
+            let guar = self.report_trait_object_with_no_traits_error(span, &trait_bounds);
+            return Ty::new_error(tcx, guar);
+        }
+        // Don't create a dyn trait if we have errors in the principal.
+        if let Err(guar) = trait_bounds.error_reported() {
+            return Ty::new_error(tcx, guar);
         }
 
         // Check that there are no gross dyn-compatibility violations;
diff --git a/tests/crashes/130521.rs b/tests/crashes/130521.rs
index ccc2b444b82..ebcfacf9623 100644
--- a/tests/crashes/130521.rs
+++ b/tests/crashes/130521.rs
@@ -1,7 +1,7 @@
 //@ known-bug: #130521
 
 #![feature(dyn_compatible_for_dispatch)]
-struct Vtable(dyn Cap);
+struct Vtable(dyn Cap<'static>);
 
 trait Cap<'a> {}
 
diff --git a/tests/rustdoc-ui/unable-fulfill-trait.rs b/tests/rustdoc-ui/unable-fulfill-trait.rs
index 4edc7ab76c1..49dce32072b 100644
--- a/tests/rustdoc-ui/unable-fulfill-trait.rs
+++ b/tests/rustdoc-ui/unable-fulfill-trait.rs
@@ -3,7 +3,6 @@
 pub struct Foo<'a, 'b, T> {
     field1: dyn Bar<'a, 'b>,
     //~^ ERROR
-    //~| ERROR
 }
 
 pub trait Bar<'x, 's, U>
diff --git a/tests/rustdoc-ui/unable-fulfill-trait.stderr b/tests/rustdoc-ui/unable-fulfill-trait.stderr
index 12e53546cda..2786a005cd1 100644
--- a/tests/rustdoc-ui/unable-fulfill-trait.stderr
+++ b/tests/rustdoc-ui/unable-fulfill-trait.stderr
@@ -5,7 +5,7 @@ LL |     field1: dyn Bar<'a, 'b>,
    |                 ^^^ expected 1 generic argument
    |
 note: trait defined here, with 1 generic parameter: `U`
-  --> $DIR/unable-fulfill-trait.rs:9:11
+  --> $DIR/unable-fulfill-trait.rs:8:11
    |
 LL | pub trait Bar<'x, 's, U>
    |           ^^^         -
@@ -14,13 +14,6 @@ help: add missing generic argument
 LL |     field1: dyn Bar<'a, 'b, U>,
    |                           +++
 
-error[E0227]: ambiguous lifetime bound, explicit lifetime bound required
-  --> $DIR/unable-fulfill-trait.rs:4:13
-   |
-LL |     field1: dyn Bar<'a, 'b>,
-   |             ^^^^^^^^^^^^^^^
-
-error: aborting due to 2 previous errors
+error: aborting due to 1 previous error
 
-Some errors have detailed explanations: E0107, E0227.
-For more information about an error, try `rustc --explain E0107`.
+For more information about this error, try `rustc --explain E0107`.
diff --git a/tests/ui/associated-types/issue-22560.rs b/tests/ui/associated-types/issue-22560.rs
index 44be8817b08..465aea515ee 100644
--- a/tests/ui/associated-types/issue-22560.rs
+++ b/tests/ui/associated-types/issue-22560.rs
@@ -7,9 +7,6 @@ trait Sub<Rhs=Self> {
 }
 
 type Test = dyn Add + Sub;
-//~^ ERROR E0393
-//~| ERROR E0191
-//~| ERROR E0393
-//~| ERROR E0225
+//~^ ERROR E0225
 
 fn main() { }
diff --git a/tests/ui/associated-types/issue-22560.stderr b/tests/ui/associated-types/issue-22560.stderr
index 834040490f9..d0b6adc520c 100644
--- a/tests/ui/associated-types/issue-22560.stderr
+++ b/tests/ui/associated-types/issue-22560.stderr
@@ -9,56 +9,6 @@ LL | type Test = dyn Add + Sub;
    = help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: Add + Sub {}`
    = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
 
-error[E0191]: the value of the associated types `Output` in `Add`, `Output` in `Sub` must be specified
-  --> $DIR/issue-22560.rs:9:17
-   |
-LL |     type Output;
-   |     ----------- `Output` defined here
-...
-LL |     type Output;
-   |     ----------- `Output` defined here
-...
-LL | type Test = dyn Add + Sub;
-   |                 ^^^   ^^^ associated type `Output` must be specified
-   |                 |
-   |                 associated type `Output` must be specified
-   |
-help: specify the associated types
-   |
-LL | type Test = dyn Add<Output = Type> + Sub<Output = Type>;
-   |                 ~~~~~~~~~~~~~~~~~~   ~~~~~~~~~~~~~~~~~~
-
-error[E0393]: the type parameter `Rhs` must be explicitly specified
-  --> $DIR/issue-22560.rs:9:17
-   |
-LL | trait Add<Rhs=Self> {
-   | ------------------- type parameter `Rhs` must be specified for this
-...
-LL | type Test = dyn Add + Sub;
-   |                 ^^^
-   |
-   = note: because of the default `Self` reference, type parameters must be specified on object types
-help: set the type parameter to the desired type
-   |
-LL | type Test = dyn Add<Rhs> + Sub;
-   |                    +++++
-
-error[E0393]: the type parameter `Rhs` must be explicitly specified
-  --> $DIR/issue-22560.rs:9:23
-   |
-LL | trait Sub<Rhs=Self> {
-   | ------------------- type parameter `Rhs` must be specified for this
-...
-LL | type Test = dyn Add + Sub;
-   |                       ^^^
-   |
-   = note: because of the default `Self` reference, type parameters must be specified on object types
-help: set the type parameter to the desired type
-   |
-LL | type Test = dyn Add + Sub<Rhs>;
-   |                          +++++
-
-error: aborting due to 4 previous errors
+error: aborting due to 1 previous error
 
-Some errors have detailed explanations: E0191, E0225, E0393.
-For more information about an error, try `rustc --explain E0191`.
+For more information about this error, try `rustc --explain E0225`.
diff --git a/tests/ui/associated-types/missing-associated-types.rs b/tests/ui/associated-types/missing-associated-types.rs
index 3c8410e39bd..4e532715f1e 100644
--- a/tests/ui/associated-types/missing-associated-types.rs
+++ b/tests/ui/associated-types/missing-associated-types.rs
@@ -11,16 +11,12 @@ trait Fine<Rhs>: Div<Rhs, Output = Rhs> {}
 
 type Foo<Rhs> = dyn Add<Rhs> + Sub<Rhs> + X<Rhs> + Y<Rhs>;
 //~^ ERROR only auto traits can be used as additional traits in a trait object
-//~| ERROR the value of the associated types
 type Bar<Rhs> = dyn Add<Rhs> + Sub<Rhs> + X<Rhs> + Z<Rhs>;
 //~^ ERROR only auto traits can be used as additional traits in a trait object
-//~| ERROR the value of the associated types
 type Baz<Rhs> = dyn Add<Rhs> + Sub<Rhs> + Y<Rhs>;
 //~^ ERROR only auto traits can be used as additional traits in a trait object
-//~| ERROR the value of the associated types
 type Bat<Rhs> = dyn Add<Rhs> + Sub<Rhs> + Fine<Rhs>;
 //~^ ERROR only auto traits can be used as additional traits in a trait object
-//~| ERROR the value of the associated types
 type Bal<Rhs> = dyn X<Rhs>;
 //~^ ERROR the value of the associated types
 
diff --git a/tests/ui/associated-types/missing-associated-types.stderr b/tests/ui/associated-types/missing-associated-types.stderr
index 0636667ea1f..ce4b57e8af8 100644
--- a/tests/ui/associated-types/missing-associated-types.stderr
+++ b/tests/ui/associated-types/missing-associated-types.stderr
@@ -9,26 +9,8 @@ LL | type Foo<Rhs> = dyn Add<Rhs> + Sub<Rhs> + X<Rhs> + Y<Rhs>;
    = help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: Add<Rhs> + Sub<Rhs> + X<Rhs> + Y<Rhs> {}`
    = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
 
-error[E0191]: the value of the associated types `A` in `Y`, `Output` in `Add`, `Output` in `Mul`, `Output` in `Sub` must be specified
-  --> $DIR/missing-associated-types.rs:12:21
-   |
-LL |     type A;
-   |     ------ `A` defined here
-...
-LL | type Foo<Rhs> = dyn Add<Rhs> + Sub<Rhs> + X<Rhs> + Y<Rhs>;
-   |                     ^^^^^^^^   ^^^^^^^^   ^^^^^^   ^^^^^^ associated type `A` must be specified
-   |                     |          |          |
-   |                     |          |          associated type `Output` must be specified
-   |                     |          associated type `Output` must be specified
-   |                     associated type `Output` must be specified
-   |
-help: specify the associated types
-   |
-LL | type Foo<Rhs> = dyn Add<Rhs, Output = Type> + Sub<Rhs, Output = Type> + X<Rhs, Output = Type> + Y<Rhs, A = Type>;
-   |                     ~~~~~~~~~~~~~~~~~~~~~~~   ~~~~~~~~~~~~~~~~~~~~~~~   ~~~~~~~~~~~~~~~~~~~~~   ~~~~~~~~~~~~~~~~
-
 error[E0225]: only auto traits can be used as additional traits in a trait object
-  --> $DIR/missing-associated-types.rs:15:32
+  --> $DIR/missing-associated-types.rs:14:32
    |
 LL | type Bar<Rhs> = dyn Add<Rhs> + Sub<Rhs> + X<Rhs> + Z<Rhs>;
    |                     --------   ^^^^^^^^ additional non-auto trait
@@ -38,33 +20,8 @@ LL | type Bar<Rhs> = dyn Add<Rhs> + Sub<Rhs> + X<Rhs> + Z<Rhs>;
    = help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: Add<Rhs> + Sub<Rhs> + X<Rhs> + Z<Rhs> {}`
    = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
 
-error[E0191]: the value of the associated types `A` and `B` in `Z`, `Output` and `Output` in `Div`, `Output` in `Add`, `Output` in `Mul`, `Output` in `Sub` must be specified
-  --> $DIR/missing-associated-types.rs:15:21
-   |
-LL |     type A;
-   |     ------ `A` defined here
-LL |     type B;
-   |     ------ `B` defined here
-...
-LL | type Bar<Rhs> = dyn Add<Rhs> + Sub<Rhs> + X<Rhs> + Z<Rhs>;
-   |                     ^^^^^^^^   ^^^^^^^^   ^^^^^^   ^^^^^^ associated types `A`, `B`, `Output` must be specified
-   |                     |          |          |
-   |                     |          |          associated types `Output` (from trait `Div`), `Output` (from trait `Mul`) must be specified
-   |                     |          associated type `Output` must be specified
-   |                     associated type `Output` must be specified
-   |
-help: consider introducing a new type parameter, adding `where` constraints using the fully-qualified path to the associated types
-  --> $DIR/missing-associated-types.rs:15:43
-   |
-LL | type Bar<Rhs> = dyn Add<Rhs> + Sub<Rhs> + X<Rhs> + Z<Rhs>;
-   |                                           ^^^^^^
-help: specify the associated types
-   |
-LL | type Bar<Rhs> = dyn Add<Rhs, Output = Type> + Sub<Rhs, Output = Type> + X<Rhs> + Z<Rhs, A = Type, B = Type, Output = Type>;
-   |                     ~~~~~~~~~~~~~~~~~~~~~~~   ~~~~~~~~~~~~~~~~~~~~~~~            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
 error[E0225]: only auto traits can be used as additional traits in a trait object
-  --> $DIR/missing-associated-types.rs:18:32
+  --> $DIR/missing-associated-types.rs:16:32
    |
 LL | type Baz<Rhs> = dyn Add<Rhs> + Sub<Rhs> + Y<Rhs>;
    |                     --------   ^^^^^^^^ additional non-auto trait
@@ -74,25 +31,8 @@ LL | type Baz<Rhs> = dyn Add<Rhs> + Sub<Rhs> + Y<Rhs>;
    = help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: Add<Rhs> + Sub<Rhs> + Y<Rhs> {}`
    = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
 
-error[E0191]: the value of the associated types `A` in `Y`, `Output` in `Add`, `Output` in `Sub` must be specified
-  --> $DIR/missing-associated-types.rs:18:21
-   |
-LL |     type A;
-   |     ------ `A` defined here
-...
-LL | type Baz<Rhs> = dyn Add<Rhs> + Sub<Rhs> + Y<Rhs>;
-   |                     ^^^^^^^^   ^^^^^^^^   ^^^^^^ associated type `A` must be specified
-   |                     |          |
-   |                     |          associated type `Output` must be specified
-   |                     associated type `Output` must be specified
-   |
-help: specify the associated types
-   |
-LL | type Baz<Rhs> = dyn Add<Rhs, Output = Type> + Sub<Rhs, Output = Type> + Y<Rhs, A = Type>;
-   |                     ~~~~~~~~~~~~~~~~~~~~~~~   ~~~~~~~~~~~~~~~~~~~~~~~   ~~~~~~~~~~~~~~~~
-
 error[E0225]: only auto traits can be used as additional traits in a trait object
-  --> $DIR/missing-associated-types.rs:21:32
+  --> $DIR/missing-associated-types.rs:18:32
    |
 LL | type Bat<Rhs> = dyn Add<Rhs> + Sub<Rhs> + Fine<Rhs>;
    |                     --------   ^^^^^^^^ additional non-auto trait
@@ -102,28 +42,15 @@ LL | type Bat<Rhs> = dyn Add<Rhs> + Sub<Rhs> + Fine<Rhs>;
    = help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: Add<Rhs> + Sub<Rhs> + Fine<Rhs> {}`
    = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
 
-error[E0191]: the value of the associated types `Output` in `Add`, `Output` in `Sub` must be specified
-  --> $DIR/missing-associated-types.rs:21:21
-   |
-LL | type Bat<Rhs> = dyn Add<Rhs> + Sub<Rhs> + Fine<Rhs>;
-   |                     ^^^^^^^^   ^^^^^^^^ associated type `Output` must be specified
-   |                     |
-   |                     associated type `Output` must be specified
-   |
-help: specify the associated types
-   |
-LL | type Bat<Rhs> = dyn Add<Rhs, Output = Type> + Sub<Rhs, Output = Type> + Fine<Rhs>;
-   |                     ~~~~~~~~~~~~~~~~~~~~~~~   ~~~~~~~~~~~~~~~~~~~~~~~
-
 error[E0191]: the value of the associated types `Output` in `Div`, `Output` in `Mul` must be specified
-  --> $DIR/missing-associated-types.rs:24:21
+  --> $DIR/missing-associated-types.rs:20:21
    |
 LL | type Bal<Rhs> = dyn X<Rhs>;
    |                     ^^^^^^ associated types `Output` (from trait `Div`), `Output` (from trait `Mul`) must be specified
    |
    = help: consider introducing a new type parameter, adding `where` constraints using the fully-qualified path to the associated types
 
-error: aborting due to 9 previous errors
+error: aborting due to 5 previous errors
 
 Some errors have detailed explanations: E0191, E0225.
 For more information about an error, try `rustc --explain E0191`.
diff --git a/tests/ui/const-generics/not_wf_param_in_rpitit.rs b/tests/ui/const-generics/not_wf_param_in_rpitit.rs
index b454562ad49..cb1e90923e7 100644
--- a/tests/ui/const-generics/not_wf_param_in_rpitit.rs
+++ b/tests/ui/const-generics/not_wf_param_in_rpitit.rs
@@ -3,9 +3,6 @@
 trait Trait<const N: dyn Trait = bar> {
     //~^ ERROR: cannot find value `bar` in this scope
     //~| ERROR: cycle detected when computing type of `Trait::N`
-    //~| ERROR: the trait `Trait` cannot be made into an object
-    //~| ERROR: the trait `Trait` cannot be made into an object
-    //~| ERROR: the trait `Trait` cannot be made into an object
     async fn a() {}
 }
 
diff --git a/tests/ui/const-generics/not_wf_param_in_rpitit.stderr b/tests/ui/const-generics/not_wf_param_in_rpitit.stderr
index 2500409e828..42ae012fa55 100644
--- a/tests/ui/const-generics/not_wf_param_in_rpitit.stderr
+++ b/tests/ui/const-generics/not_wf_param_in_rpitit.stderr
@@ -18,77 +18,7 @@ LL | trait Trait<const N: dyn Trait = bar> {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
 
-error[E0038]: the trait `Trait` cannot be made into an object
-  --> $DIR/not_wf_param_in_rpitit.rs:3:22
-   |
-LL | trait Trait<const N: dyn Trait = bar> {
-   |                      ^^^^^^^^^ `Trait` cannot be made into an object
-   |
-note: for a trait to be "dyn-compatible" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
-  --> $DIR/not_wf_param_in_rpitit.rs:9:14
-   |
-LL | trait Trait<const N: dyn Trait = bar> {
-   |       ----- this trait cannot be made into an object...
-...
-LL |     async fn a() {}
-   |              ^ ...because associated function `a` has no `self` parameter
-help: consider turning `a` into a method by giving it a `&self` argument
-   |
-LL |     async fn a(&self) {}
-   |                +++++
-help: alternatively, consider constraining `a` so it does not apply to trait objects
-   |
-LL |     async fn a() where Self: Sized {}
-   |                  +++++++++++++++++
-
-error[E0038]: the trait `Trait` cannot be made into an object
-  --> $DIR/not_wf_param_in_rpitit.rs:3:13
-   |
-LL | trait Trait<const N: dyn Trait = bar> {
-   |             ^^^^^^^^^^^^^^^^^^^^^^^^ `Trait` cannot be made into an object
-   |
-note: for a trait to be "dyn-compatible" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
-  --> $DIR/not_wf_param_in_rpitit.rs:9:14
-   |
-LL | trait Trait<const N: dyn Trait = bar> {
-   |       ----- this trait cannot be made into an object...
-...
-LL |     async fn a() {}
-   |              ^ ...because associated function `a` has no `self` parameter
-help: consider turning `a` into a method by giving it a `&self` argument
-   |
-LL |     async fn a(&self) {}
-   |                +++++
-help: alternatively, consider constraining `a` so it does not apply to trait objects
-   |
-LL |     async fn a() where Self: Sized {}
-   |                  +++++++++++++++++
-
-error[E0038]: the trait `Trait` cannot be made into an object
-  --> $DIR/not_wf_param_in_rpitit.rs:3:13
-   |
-LL | trait Trait<const N: dyn Trait = bar> {
-   |             ^^^^^^^^^^^^^^^^^^^^^^^^ `Trait` cannot be made into an object
-   |
-note: for a trait to be "dyn-compatible" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
-  --> $DIR/not_wf_param_in_rpitit.rs:9:14
-   |
-LL | trait Trait<const N: dyn Trait = bar> {
-   |       ----- this trait cannot be made into an object...
-...
-LL |     async fn a() {}
-   |              ^ ...because associated function `a` has no `self` parameter
-   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
-help: consider turning `a` into a method by giving it a `&self` argument
-   |
-LL |     async fn a(&self) {}
-   |                +++++
-help: alternatively, consider constraining `a` so it does not apply to trait objects
-   |
-LL |     async fn a() where Self: Sized {}
-   |                  +++++++++++++++++
-
-error: aborting due to 5 previous errors
+error: aborting due to 2 previous errors
 
-Some errors have detailed explanations: E0038, E0391, E0425.
-For more information about an error, try `rustc --explain E0038`.
+Some errors have detailed explanations: E0391, E0425.
+For more information about an error, try `rustc --explain E0391`.
diff --git a/tests/ui/issues/issue-23024.rs b/tests/ui/issues/issue-23024.rs
index 25220dc3e61..1b072dd7b69 100644
--- a/tests/ui/issues/issue-23024.rs
+++ b/tests/ui/issues/issue-23024.rs
@@ -8,5 +8,4 @@ fn main()
     println!("{:?}",(vfnfer[0] as dyn Fn)(3));
     //~^ ERROR the precise format of `Fn`-family traits'
     //~| ERROR missing generics for trait `Fn`
-    //~| ERROR the value of the associated type `Output` in `FnOnce`
 }
diff --git a/tests/ui/issues/issue-23024.stderr b/tests/ui/issues/issue-23024.stderr
index 62278a51be6..51db0414f3a 100644
--- a/tests/ui/issues/issue-23024.stderr
+++ b/tests/ui/issues/issue-23024.stderr
@@ -19,13 +19,7 @@ help: add missing generic argument
 LL |     println!("{:?}",(vfnfer[0] as dyn Fn<Args>)(3));
    |                                         ++++++
 
-error[E0191]: the value of the associated type `Output` in `FnOnce` must be specified
-  --> $DIR/issue-23024.rs:8:39
-   |
-LL |     println!("{:?}",(vfnfer[0] as dyn Fn)(3));
-   |                                       ^^ help: specify the associated type: `Fn::<Output = Type>`
-
-error: aborting due to 3 previous errors
+error: aborting due to 2 previous errors
 
-Some errors have detailed explanations: E0107, E0191, E0658.
+Some errors have detailed explanations: E0107, E0658.
 For more information about an error, try `rustc --explain E0107`.
diff --git a/tests/ui/issues/issue-34373.rs b/tests/ui/issues/issue-34373.rs
index dc20c5589b3..707aa8cf338 100644
--- a/tests/ui/issues/issue-34373.rs
+++ b/tests/ui/issues/issue-34373.rs
@@ -6,7 +6,6 @@ trait Trait<T> {
 
 pub struct Foo<T = Box<Trait<DefaultFoo>>>;  //~ ERROR cycle detected
 //~^ ERROR `T` is never used
-//~| ERROR `Trait` cannot be made into an object
 type DefaultFoo = Foo;
 
 fn main() {
diff --git a/tests/ui/issues/issue-34373.stderr b/tests/ui/issues/issue-34373.stderr
index 4e8e7c61fee..06365558217 100644
--- a/tests/ui/issues/issue-34373.stderr
+++ b/tests/ui/issues/issue-34373.stderr
@@ -5,7 +5,7 @@ LL | pub struct Foo<T = Box<Trait<DefaultFoo>>>;
    |                              ^^^^^^^^^^
    |
 note: ...which requires expanding type alias `DefaultFoo`...
-  --> $DIR/issue-34373.rs:10:19
+  --> $DIR/issue-34373.rs:9:19
    |
 LL | type DefaultFoo = Foo;
    |                   ^^^
@@ -17,28 +17,6 @@ LL | pub struct Foo<T = Box<Trait<DefaultFoo>>>;
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
 
-error[E0038]: the trait `Trait` cannot be made into an object
-  --> $DIR/issue-34373.rs:7:24
-   |
-LL | pub struct Foo<T = Box<Trait<DefaultFoo>>>;
-   |                        ^^^^^^^^^^^^^^^^^ `Trait` cannot be made into an object
-   |
-note: for a trait to be "dyn-compatible" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
-  --> $DIR/issue-34373.rs:4:8
-   |
-LL | trait Trait<T> {
-   |       ----- this trait cannot be made into an object...
-LL |     fn foo(_: T) {}
-   |        ^^^ ...because associated function `foo` has no `self` parameter
-help: consider turning `foo` into a method by giving it a `&self` argument
-   |
-LL |     fn foo(&self, _: T) {}
-   |            ++++++
-help: alternatively, consider constraining `foo` so it does not apply to trait objects
-   |
-LL |     fn foo(_: T) where Self: Sized {}
-   |                  +++++++++++++++++
-
 error[E0392]: type parameter `T` is never used
   --> $DIR/issue-34373.rs:7:16
    |
@@ -48,7 +26,7 @@ LL | pub struct Foo<T = Box<Trait<DefaultFoo>>>;
    = help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData`
    = help: if you intended `T` to be a const parameter, use `const T: /* Type */` instead
 
-error: aborting due to 3 previous errors
+error: aborting due to 2 previous errors
 
-Some errors have detailed explanations: E0038, E0391, E0392.
-For more information about an error, try `rustc --explain E0038`.
+Some errors have detailed explanations: E0391, E0392.
+For more information about an error, try `rustc --explain E0391`.
diff --git a/tests/ui/suggestions/use-type-argument-instead-of-assoc-type.rs b/tests/ui/suggestions/use-type-argument-instead-of-assoc-type.rs
index ed262fd39a5..c2387bf5411 100644
--- a/tests/ui/suggestions/use-type-argument-instead-of-assoc-type.rs
+++ b/tests/ui/suggestions/use-type-argument-instead-of-assoc-type.rs
@@ -5,8 +5,7 @@ pub trait T<X, Y> {
 }
 pub struct Foo {
     i: Box<dyn T<usize, usize, usize, usize, B=usize>>,
-    //~^ ERROR must be specified
-    //~| ERROR trait takes 2 generic arguments but 4 generic arguments were supplied
+    //~^ ERROR trait takes 2 generic arguments but 4 generic arguments were supplied
 }
 
 
diff --git a/tests/ui/suggestions/use-type-argument-instead-of-assoc-type.stderr b/tests/ui/suggestions/use-type-argument-instead-of-assoc-type.stderr
index 7c84dd4b8ff..18cf0674f02 100644
--- a/tests/ui/suggestions/use-type-argument-instead-of-assoc-type.stderr
+++ b/tests/ui/suggestions/use-type-argument-instead-of-assoc-type.stderr
@@ -14,19 +14,6 @@ help: replace the generic bounds with the associated types
 LL |     i: Box<dyn T<usize, usize, A = usize, C = usize, B=usize>>,
    |                                +++        +++
 
-error[E0191]: the value of the associated types `C` and `A` in `T` must be specified
-  --> $DIR/use-type-argument-instead-of-assoc-type.rs:7:16
-   |
-LL |     type A;
-   |     ------ `A` defined here
-LL |     type B;
-LL |     type C;
-   |     ------ `C` defined here
-...
-LL |     i: Box<dyn T<usize, usize, usize, usize, B=usize>>,
-   |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ associated types `A`, `C` must be specified
-
-error: aborting due to 2 previous errors
+error: aborting due to 1 previous error
 
-Some errors have detailed explanations: E0107, E0191.
-For more information about an error, try `rustc --explain E0107`.
+For more information about this error, try `rustc --explain E0107`.
diff --git a/tests/ui/traits/bad-sized.rs b/tests/ui/traits/bad-sized.rs
index a1521967978..7e4f37e4ae2 100644
--- a/tests/ui/traits/bad-sized.rs
+++ b/tests/ui/traits/bad-sized.rs
@@ -3,7 +3,4 @@ trait Trait {}
 pub fn main() {
     let x: Vec<dyn Trait + Sized> = Vec::new();
     //~^ ERROR only auto traits can be used as additional traits in a trait object
-    //~| ERROR the size for values of type
-    //~| ERROR the size for values of type
-    //~| ERROR the size for values of type
 }
diff --git a/tests/ui/traits/bad-sized.stderr b/tests/ui/traits/bad-sized.stderr
index 4c1835dfed0..0e82867ef03 100644
--- a/tests/ui/traits/bad-sized.stderr
+++ b/tests/ui/traits/bad-sized.stderr
@@ -9,37 +9,6 @@ LL |     let x: Vec<dyn Trait + Sized> = Vec::new();
    = help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: Trait + Sized {}`
    = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
 
-error[E0277]: the size for values of type `dyn Trait` cannot be known at compilation time
-  --> $DIR/bad-sized.rs:4:12
-   |
-LL |     let x: Vec<dyn Trait + Sized> = Vec::new();
-   |            ^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
-   |
-   = help: the trait `Sized` is not implemented for `dyn Trait`
-note: required by an implicit `Sized` bound in `Vec`
-  --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL
-
-error[E0277]: the size for values of type `dyn Trait` cannot be known at compilation time
-  --> $DIR/bad-sized.rs:4:37
-   |
-LL |     let x: Vec<dyn Trait + Sized> = Vec::new();
-   |                                     ^^^^^^^^^^ doesn't have a size known at compile-time
-   |
-   = help: the trait `Sized` is not implemented for `dyn Trait`
-note: required by a bound in `Vec::<T>::new`
-  --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL
-
-error[E0277]: the size for values of type `dyn Trait` cannot be known at compilation time
-  --> $DIR/bad-sized.rs:4:37
-   |
-LL |     let x: Vec<dyn Trait + Sized> = Vec::new();
-   |                                     ^^^ doesn't have a size known at compile-time
-   |
-   = help: the trait `Sized` is not implemented for `dyn Trait`
-note: required by an implicit `Sized` bound in `Vec`
-  --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL
-
-error: aborting due to 4 previous errors
+error: aborting due to 1 previous error
 
-Some errors have detailed explanations: E0225, E0277.
-For more information about an error, try `rustc --explain E0225`.
+For more information about this error, try `rustc --explain E0225`.
diff --git a/tests/ui/traits/issue-32963.rs b/tests/ui/traits/issue-32963.rs
index 56a68f3a231..4c4cd91d72e 100644
--- a/tests/ui/traits/issue-32963.rs
+++ b/tests/ui/traits/issue-32963.rs
@@ -7,5 +7,4 @@ fn size_of_copy<T: Copy+?Sized>() -> usize { mem::size_of::<T>() }
 fn main() {
     size_of_copy::<dyn Misc + Copy>();
     //~^ ERROR only auto traits can be used as additional traits in a trait object
-    //~| ERROR the trait bound `dyn Misc: Copy` is not satisfied
 }
diff --git a/tests/ui/traits/issue-32963.stderr b/tests/ui/traits/issue-32963.stderr
index bad45e54d64..1c70d0aaa0a 100644
--- a/tests/ui/traits/issue-32963.stderr
+++ b/tests/ui/traits/issue-32963.stderr
@@ -9,19 +9,6 @@ LL |     size_of_copy::<dyn Misc + Copy>();
    = help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: Misc + Copy {}`
    = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
 
-error[E0277]: the trait bound `dyn Misc: Copy` is not satisfied
-  --> $DIR/issue-32963.rs:8:20
-   |
-LL |     size_of_copy::<dyn Misc + Copy>();
-   |                    ^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `dyn Misc`
-   |
-note: required by a bound in `size_of_copy`
-  --> $DIR/issue-32963.rs:5:20
-   |
-LL | fn size_of_copy<T: Copy+?Sized>() -> usize { mem::size_of::<T>() }
-   |                    ^^^^ required by this bound in `size_of_copy`
-
-error: aborting due to 2 previous errors
+error: aborting due to 1 previous error
 
-Some errors have detailed explanations: E0225, E0277.
-For more information about an error, try `rustc --explain E0225`.
+For more information about this error, try `rustc --explain E0225`.
diff --git a/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122199.rs b/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122199.rs
index 53363319ba0..a95e10b7265 100644
--- a/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122199.rs
+++ b/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122199.rs
@@ -1,11 +1,6 @@
 trait Trait<const N: Trait = bar> {
     //~^ ERROR cannot find value `bar` in this scope
     //~| ERROR cycle detected when computing type of `Trait::N`
-    //~| ERROR the trait `Trait` cannot be made into an object
-    //~| ERROR the trait `Trait` cannot be made into an object
-    //~| ERROR the trait `Trait` cannot be made into an object
-    //~| WARN trait objects without an explicit `dyn` are deprecated [bare_trait_objects]
-    //~| WARN this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
     //~| WARN trait objects without an explicit `dyn` are deprecated [bare_trait_objects]
     //~| WARN this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
     fn fnc<const N: Trait = u32>(&self) -> Trait {
@@ -13,9 +8,6 @@ trait Trait<const N: Trait = bar> {
         //~| ERROR expected value, found builtin type `u32`
         //~| ERROR defaults for const parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
         //~| ERROR associated item referring to unboxed trait object for its own trait
-        //~| ERROR the trait `Trait` cannot be made into an object
-        //~| WARN trait objects without an explicit `dyn` are deprecated [bare_trait_objects]
-        //~| WARN this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
         //~| WARN trait objects without an explicit `dyn` are deprecated [bare_trait_objects]
         //~| WARN this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
         //~| WARN trait objects without an explicit `dyn` are deprecated [bare_trait_objects]
diff --git a/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122199.stderr b/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122199.stderr
index fefb788fac7..339f7b2cc82 100644
--- a/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122199.stderr
+++ b/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122199.stderr
@@ -1,5 +1,5 @@
 error[E0403]: the name `N` is already used for a generic parameter in this item's generic parameters
-  --> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:11:18
+  --> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:6:18
    |
 LL | trait Trait<const N: Trait = bar> {
    |                   - first use of `N`
@@ -14,13 +14,13 @@ LL | trait Trait<const N: Trait = bar> {
    |                              ^^^ not found in this scope
 
 error[E0423]: expected value, found builtin type `u32`
-  --> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:11:29
+  --> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:6:29
    |
 LL |     fn fnc<const N: Trait = u32>(&self) -> Trait {
    |                             ^^^ not a value
 
 error[E0425]: cannot find value `bar` in this scope
-  --> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:23:9
+  --> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:15:9
    |
 LL |         bar
    |         ^^^ not found in this scope
@@ -53,27 +53,8 @@ LL | trait Trait<const N: Trait = bar> {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
 
-error: defaults for const parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
-  --> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:11:12
-   |
-LL |     fn fnc<const N: Trait = u32>(&self) -> Trait {
-   |            ^^^^^^^^^^^^^^^^^^^^
-
 warning: trait objects without an explicit `dyn` are deprecated
-  --> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:11:21
-   |
-LL |     fn fnc<const N: Trait = u32>(&self) -> Trait {
-   |                     ^^^^^
-   |
-   = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
-   = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
-help: if this is a dyn-compatible trait, use `dyn`
-   |
-LL |     fn fnc<const N: dyn Trait = u32>(&self) -> Trait {
-   |                     +++
-
-warning: trait objects without an explicit `dyn` are deprecated
-  --> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:11:44
+  --> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:6:44
    |
 LL |     fn fnc<const N: Trait = u32>(&self) -> Trait {
    |                                            ^^^^^
@@ -85,114 +66,40 @@ help: if this is a dyn-compatible trait, use `dyn`
 LL |     fn fnc<const N: Trait = u32>(&self) -> dyn Trait {
    |                                            +++
 
-warning: trait objects without an explicit `dyn` are deprecated
-  --> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:1:22
-   |
-LL | trait Trait<const N: Trait = bar> {
-   |                      ^^^^^
-   |
-   = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
-   = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
-   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
-help: if this is a dyn-compatible trait, use `dyn`
-   |
-LL | trait Trait<const N: dyn Trait = bar> {
-   |                      +++
-
-error[E0038]: the trait `Trait` cannot be made into an object
-  --> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:1:22
-   |
-LL | trait Trait<const N: Trait = bar> {
-   |                      ^^^^^ `Trait` cannot be made into an object
-   |
-note: for a trait to be "dyn-compatible" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
-  --> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:11:8
-   |
-LL | trait Trait<const N: Trait = bar> {
-   |       ----- this trait cannot be made into an object...
-...
-LL |     fn fnc<const N: Trait = u32>(&self) -> Trait {
-   |        ^^^ ...because method `fnc` has generic type parameters
-   = help: consider moving `fnc` to another trait
-
-error[E0038]: the trait `Trait` cannot be made into an object
-  --> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:1:13
-   |
-LL | trait Trait<const N: Trait = bar> {
-   |             ^^^^^^^^^^^^^^^^^^^^ `Trait` cannot be made into an object
-   |
-note: for a trait to be "dyn-compatible" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
-  --> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:11:8
-   |
-LL | trait Trait<const N: Trait = bar> {
-   |       ----- this trait cannot be made into an object...
-...
-LL |     fn fnc<const N: Trait = u32>(&self) -> Trait {
-   |        ^^^ ...because method `fnc` has generic type parameters
-   = help: consider moving `fnc` to another trait
-
-error: associated item referring to unboxed trait object for its own trait
-  --> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:11:44
+error: defaults for const parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
+  --> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:6:12
    |
-LL | trait Trait<const N: Trait = bar> {
-   |       ----- in this trait
-...
 LL |     fn fnc<const N: Trait = u32>(&self) -> Trait {
-   |                                            ^^^^^
-   |
-help: you might have meant to use `Self` to refer to the implementing type
-   |
-LL |     fn fnc<const N: Trait = u32>(&self) -> Self {
-   |                                            ~~~~
+   |            ^^^^^^^^^^^^^^^^^^^^
 
 warning: trait objects without an explicit `dyn` are deprecated
-  --> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:11:21
+  --> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:6:21
    |
 LL |     fn fnc<const N: Trait = u32>(&self) -> Trait {
    |                     ^^^^^
    |
    = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
    = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
-   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
 help: if this is a dyn-compatible trait, use `dyn`
    |
 LL |     fn fnc<const N: dyn Trait = u32>(&self) -> Trait {
    |                     +++
 
-error[E0038]: the trait `Trait` cannot be made into an object
-  --> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:11:21
-   |
-LL |     fn fnc<const N: Trait = u32>(&self) -> Trait {
-   |                     ^^^^^ `Trait` cannot be made into an object
-   |
-note: for a trait to be "dyn-compatible" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
-  --> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:11:8
+error: associated item referring to unboxed trait object for its own trait
+  --> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:6:44
    |
 LL | trait Trait<const N: Trait = bar> {
-   |       ----- this trait cannot be made into an object...
+   |       ----- in this trait
 ...
 LL |     fn fnc<const N: Trait = u32>(&self) -> Trait {
-   |        ^^^ ...because method `fnc` has generic type parameters
-   = help: consider moving `fnc` to another trait
-
-error[E0038]: the trait `Trait` cannot be made into an object
-  --> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:1:13
-   |
-LL | trait Trait<const N: Trait = bar> {
-   |             ^^^^^^^^^^^^^^^^^^^^ `Trait` cannot be made into an object
+   |                                            ^^^^^
    |
-note: for a trait to be "dyn-compatible" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
-  --> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:11:8
+help: you might have meant to use `Self` to refer to the implementing type
    |
-LL | trait Trait<const N: Trait = bar> {
-   |       ----- this trait cannot be made into an object...
-...
-LL |     fn fnc<const N: Trait = u32>(&self) -> Trait {
-   |        ^^^ ...because method `fnc` has generic type parameters
-   = help: consider moving `fnc` to another trait
-   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+LL |     fn fnc<const N: Trait = u32>(&self) -> Self {
+   |                                            ~~~~
 
-error: aborting due to 11 previous errors; 5 warnings emitted
+error: aborting due to 7 previous errors; 3 warnings emitted
 
-Some errors have detailed explanations: E0038, E0391, E0403, E0423, E0425.
-For more information about an error, try `rustc --explain E0038`.
+Some errors have detailed explanations: E0391, E0403, E0423, E0425.
+For more information about an error, try `rustc --explain E0391`.