rust/tests/ui/unsafe/union_access_through_block.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

19 lines
262 B
Rust
Raw Normal View History

// check-pass
// revisions: mir thir
// [thir]compile-flags: -Z thir-unsafeck
#[derive(Copy, Clone)]
pub struct Foo { a: bool }
pub union Bar {
a: Foo,
b: u32,
}
pub fn baz(mut bar: Bar) {
unsafe {
{ bar.a }.a = true;
}
}
fn main() {}