]> git.lizzy.rs Git - rust.git/blob - src/test/ui/union/union-inherent-method.rs
Rollup merge of #100006 - jyn514:update-copy, r=dtolnay
[rust.git] / src / test / 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 }