Source code
Revision control
Copy as Markdown
Other Tools
#[repr(packed)]
struct Packed {
f: u32,
}
#[repr(packed(2))]
struct PackedN {
f: u32,
}
fn main() {
let a = Packed { f: 1 };
let _ = &a.f; //~ ERROR reference to packed field is unaligned
let b = PackedN { f: 1 };
let _ = &b.f; //~ ERROR reference to packed field is unaligned
}