Rust errors / Types and traits
Rust compiler error · checked with rustc 1.99.0
Rust error E0224: at least one trait is required for an object type
What it meansA trait object was declared with no traits.
What rustc prints
error[E0224]: at least one trait is required for an object type
--> main.rs:1:12
|
1 | type Foo = dyn 'static +;
| ^^^^^^^^^^^^^Real output of rustc 1.99.0 compiling the official example below (2021 edition). Your names and line numbers will differ; the first line is the part to match.
The compiler team's explanation
A trait object was declared with no traits.
Erroneous code example:
type Foo = dyn 'static +;
Rust does not currently support this.
To solve, ensure that the trait object has at least one trait:
type Foo = dyn 'static + Copy;From rustc --explain E0224 (1.99.0), part of the Rust project, MIT or Apache-2.0. Official page.
Related errors
- E0308mismatched types
- E0277the trait bound is not satisfied
- E0599no method named X found in the current scope
- E0433failed to resolve
- E0222ambiguous associated type `Color` in bounds of `BoxCar`
- E0223ambiguous associated type
- E0225only auto traits can be used as additional traits in a trait object
- E0271type mismatch resolving `<i8 as Trait>::AssociatedType == u32`
Up next
Often hit nextE0308: mismatched typesA related error from the same family.Read it next →Did this answer your question?