]> git.lizzy.rs Git - rust.git/blob - tests/ui/union/union-inherent-method.rs
Rollup merge of #106797 - FawazTirmizi:dev/issues/104284, r=bjorn3
[rust.git] / tests / ui / union / union-inherent-method.rs
1 // run-pass
2 // revisions: mirunsafeck thirunsafeck
3 // [thirunsafeck]compile-flags: -Z thir-unsafeck
4
5 union U {
6     a: u8,
7 }
8
9 impl U {
10     fn method(&self) -> u8 { unsafe { self.a } }
11 }
12
13 fn main() {
14     let u = U { a: 10 };
15     assert_eq!(u.method(), 10);
16 }