]> git.proxmox.com Git - rustc.git/blame - src/test/ui/union/union-lint-dead-code.rs
New upstream version 1.63.0+dfsg1
[rustc.git] / src / test / ui / union / union-lint-dead-code.rs
CommitLineData
136023e0
XL
1// revisions: mirunsafeck thirunsafeck
2// [thirunsafeck]compile-flags: -Z thir-unsafeck
3
9e0c209e
SL
4#![deny(dead_code)]
5
6union Foo {
7 x: usize,
923072b8 8 b: bool, //~ ERROR: field `b` is never read
9e0c209e
SL
9 _unused: u16,
10}
11
12fn field_read(f: Foo) -> usize {
13 unsafe { f.x }
54a0048b 14}
223e47cc 15
970d7e83 16fn main() {
9e0c209e 17 let _ = field_read(Foo { x: 2 });
223e47cc 18}