mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 23:34:48 +00:00
19 lines
312 B
Rust
19 lines
312 B
Rust
// revisions: mirunsafeck thirunsafeck
|
|
// [thirunsafeck]compile-flags: -Z thir-unsafeck
|
|
|
|
#![deny(dead_code)]
|
|
|
|
union Foo {
|
|
x: usize,
|
|
b: bool, //~ ERROR: field `b` is never read
|
|
_unused: u16,
|
|
}
|
|
|
|
fn field_read(f: Foo) -> usize {
|
|
unsafe { f.x }
|
|
}
|
|
|
|
fn main() {
|
|
let _ = field_read(Foo { x: 2 });
|
|
}
|