Rust errors / Types and traits
Rust compiler error · checked with rustc 1.99.0
Rust error E0587: type has conflicting packed and align representation hints
What it meansA type has both packed and align representation hints.
What rustc prints
error[E0587]: type has conflicting packed and align representation hints
--> main.rs:2:1
|
2 | struct Umbrella(i32);
| ^^^^^^^^^^^^^^^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 type has both packed and align representation hints.
Erroneous code example:
#[repr(packed, align(8))] // error!
struct Umbrella(i32);
You cannot use packed and align hints on a same type. If you want to pack a type to a given size, you should provide a size to packed:
#[repr(packed(8))] // ok!
struct Umbrella(i32);From rustc --explain E0587 (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
- E0579lower bound for range pattern must be less than upper bound
- E0580`main` function has wrong type
- E0588packed type cannot transitively contain a `#[repr(align)]` type
- E0593closure is expected to take 0 arguments, but it takes 1 argument
Up next
Often hit nextE0308: mismatched typesA related error from the same family.Read it next →Did this answer your question?