blob: 64c28d72e9eaa3ee59656d0e29bad07dba2a2299 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
// revisions: mirunsafeck thirunsafeck
// [thirunsafeck]compile-flags: -Z thir-unsafeck
#![deny(dead_code)]
union Foo {
x: usize,
b: bool, //~ ERROR: field is never read
_unused: u16,
}
fn field_read(f: Foo) -> usize {
unsafe { f.x }
}
fn main() {
let _ = field_read(Foo { x: 2 });
}
|