2018-09-06 07:41:12 -05:00
|
|
|
// run-pass
|
2021-05-13 09:42:25 -05:00
|
|
|
// revisions: mirunsafeck thirunsafeck
|
|
|
|
// [thirunsafeck]compile-flags: -Z thir-unsafeck
|
2018-09-06 07:41:12 -05:00
|
|
|
|
2016-08-26 11:23:42 -05:00
|
|
|
union U {
|
|
|
|
a: u8,
|
|
|
|
}
|
|
|
|
|
|
|
|
impl U {
|
|
|
|
fn method(&self) -> u8 { unsafe { self.a } }
|
2016-08-22 11:56:14 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
2016-08-26 11:23:42 -05:00
|
|
|
let u = U { a: 10 };
|
|
|
|
assert_eq!(u.method(), 10);
|
2016-08-22 11:56:14 -05:00
|
|
|
}
|