mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-11 08:05:12 +00:00
17 lines
257 B
Rust
17 lines
257 B
Rust
// run-pass
|
|
// revisions: mirunsafeck thirunsafeck
|
|
// [thirunsafeck]compile-flags: -Z thir-unsafeck
|
|
|
|
union U {
|
|
a: u8,
|
|
}
|
|
|
|
impl U {
|
|
fn method(&self) -> u8 { unsafe { self.a } }
|
|
}
|
|
|
|
fn main() {
|
|
let u = U { a: 10 };
|
|
assert_eq!(u.method(), 10);
|
|
}
|