]> git.proxmox.com Git - rustc.git/blob - src/test/ui/union/union-lint-dead-code.rs
New upstream version 1.51.0+dfsg1
[rustc.git] / src / test / ui / union / union-lint-dead-code.rs
1 #![deny(dead_code)]
2
3 union Foo {
4 x: usize,
5 b: bool, //~ ERROR: field is never read
6 _unused: u16,
7 }
8
9 fn field_read(f: Foo) -> usize {
10 unsafe { f.x }
11 }
12
13 fn main() {
14 let _ = field_read(Foo { x: 2 });
15 }