rust/tests/ui/sized-hierarchy/trait-alias-elaboration.stderr
David Wood 82a4049844
hir_analysis: add missing sizedness bounds
Default sizedness bounds were not being added to
`explicit_super_predicates_of` and `explicit_implied_predicates_of`
which meant that a trait bound added to a associated type projection
would be missing the implied predicate of the default sizedness
supertrait of that trait.

An unexpected consequence of this change was that the check for multiple
principals was now finding an additional `MetaSized` principal when
eagerly expanding trait aliases. Instead of special-casing trait aliases
as different from traits and not adding a `MetaSized` supertrait to trait
aliases, filter out `MetaSized` when lowering `dyn Trait`.
2025-10-24 15:28:34 +01:00

18 lines
868 B
Plaintext

error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-elaboration.rs:11:16
|
LL | trait Qux = Clone;
| ------------------ additional non-auto trait
LL |
LL | type Foo = dyn Qux + MetaSized;
| ^^^ --------- first non-auto trait
| |
| second non-auto trait comes from this alias
|
= help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: MetaSized + MetaSized + Clone {}`
= 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: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0225`.