Rust errors / Types and traits
Rust compiler error · checked with rustc 1.99.0
Rust error E0634: type has conflicting packed representation hints
What it meansA type has conflicting packed representation hints.
What rustc prints
error[E0634]: type has conflicting packed representation hints
--> main.rs:2:1
|
2 | struct Company(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 conflicting packed representation hints.
Erroneous code examples:
#[repr(packed, packed(2))] // error!
struct Company(i32);
#[repr(packed(2))] // error!
#[repr(packed)]
struct Company(i32);
You cannot use conflicting packed 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)] // ok!
struct Company(i32);From rustc --explain E0634 (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
- E0620cast to unsized type: `&[usize; 2]` as `[usize]`
- E0631type mismatch in closure arguments
- E0642patterns aren't allowed in functions without bodies
- E0643method `foo` has incompatible signature for trait
Up next
Often hit nextE0308: mismatched typesA related error from the same family.Read it next →Did this answer your question?