mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 23:34:48 +00:00
16 lines
365 B
Rust
16 lines
365 B
Rust
// ignore-32bit (needs `usize` to be 8-aligned to reproduce all the errors below)
|
|
#![allow(dead_code)]
|
|
// ignore-emscripten weird assertion?
|
|
|
|
#[repr(C, packed(4))]
|
|
struct Foo4C {
|
|
bar: u8,
|
|
baz: usize
|
|
}
|
|
|
|
pub fn main() {
|
|
let foo = Foo4C { bar: 1, baz: 2 };
|
|
let brw = &foo.baz; //~ERROR reference to packed field is unaligned
|
|
assert_eq!(*brw, 2);
|
|
}
|