]> git.lizzy.rs Git - rust.git/blob - tests/ui/packed/packed-struct-borrow-element-64bit.rs
Rollup merge of #107499 - compiler-errors:deduce_sig_from_projection-generator-tweak...
[rust.git] / tests / ui / packed / packed-struct-borrow-element-64bit.rs
1 // ignore-32bit (needs `usize` to be 8-aligned to reproduce all the errors below)
2 #![allow(dead_code)]
3 // ignore-emscripten weird assertion?
4
5 #[repr(C, packed(4))]
6 struct Foo4C {
7     bar: u8,
8     baz: usize
9 }
10
11 pub fn main() {
12     let foo = Foo4C { bar: 1, baz: 2 };
13     let brw = &foo.baz; //~ERROR reference to packed field is unaligned
14     assert_eq!(*brw, 2);
15 }