summaryrefslogtreecommitdiffstats
path: root/tests/ui/unsafe/union_access_through_block.rs
blob: e4c0976b82659bee7d0879f6f3a031762d662ef3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// 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() {}