rust/tests/ui/const-generics/generic_const_exprs/dyn-compatibility-err-where-bounds.stderr
Taylor Cramer d00d4dfe0d Refactor dyn-compatibility error and suggestions
This CL makes a number of small changes to dyn compatibility errors:
- "object safety" has been renamed to "dyn-compatibility" throughout
- "Convert to enum" suggestions are no longer generated when there
  exists a type-generic impl of the trait or an impl for `dyn OtherTrait`
- Several error messages are reorganized for user readability

Additionally, the dyn compatibility error creation code has been
split out into functions.

cc #132713
cc #133267
2025-01-22 09:20:57 -08:00

38 lines
1.6 KiB
Plaintext

error[E0038]: the trait `Foo` is not dyn compatible
--> $DIR/dyn-compatibility-err-where-bounds.rs:15:16
|
LL | fn use_dyn(v: &dyn Foo) {
| ^^^^^^^ `Foo` is not dyn compatible
|
note: for a trait to be dyn compatible it needs to allow building a vtable
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
--> $DIR/dyn-compatibility-err-where-bounds.rs:8:8
|
LL | trait Foo {
| --- this trait is not dyn compatible...
LL | fn test(&self) where [u8; bar::<Self>()]: Sized;
| ^^^^ ...because method `test` references the `Self` type in its `where` clause
= help: consider moving `test` to another trait
= help: only type `()` implements `Foo`; consider using it directly instead.
error[E0038]: the trait `Foo` is not dyn compatible
--> $DIR/dyn-compatibility-err-where-bounds.rs:17:5
|
LL | v.test();
| ^^^^^^^^ `Foo` is not dyn compatible
|
note: for a trait to be dyn compatible it needs to allow building a vtable
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
--> $DIR/dyn-compatibility-err-where-bounds.rs:8:8
|
LL | trait Foo {
| --- this trait is not dyn compatible...
LL | fn test(&self) where [u8; bar::<Self>()]: Sized;
| ^^^^ ...because method `test` references the `Self` type in its `where` clause
= help: consider moving `test` to another trait
= help: only type `()` implements `Foo`; consider using it directly instead.
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0038`.