]> git.lizzy.rs Git - rust.git/blob - src/test/ui/uninhabited/privately-uninhabited-dead-code.rs
Auto merge of #88798 - sunfishcode:sunfishcode/windows-null-handles, r=joshtriplett
[rust.git] / src / test / ui / uninhabited / privately-uninhabited-dead-code.rs
1 // build-pass (FIXME(62277): could be check-pass?)
2
3 #![deny(unused_variables)]
4
5 mod foo {
6     enum Bar {}
7
8     #[allow(dead_code)]
9     pub struct Foo {
10         value: Bar, // "privately" uninhabited
11     }
12
13     pub fn give_foo() -> Foo { panic!() }
14 }
15
16 fn main() {
17     let a = 42;
18     foo::give_foo();
19     println!("Hello, {}", a); // ok: we can't tell that this code is dead
20 }