]> git.proxmox.com Git - rustc.git/blob - src/test/ui/uninhabited/privately-uninhabited-dead-code.rs
New upstream version 1.38.0+dfsg1
[rustc.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 }