]>
Commit | Line | Data |
---|---|---|
17df50a5 | 1 | //! Make sure we error on erroneous consts even if they are unused. |
2b03887a | 2 | #![allow(unconditional_panic)] |
17df50a5 XL |
3 | |
4 | struct PrintName<T>(T); | |
5 | impl<T> PrintName<T> { | |
2b03887a | 6 | const VOID: () = [()][2]; //~ERROR evaluation of `PrintName::<i32>::VOID` failed |
17df50a5 XL |
7 | } |
8 | ||
9 | pub static FOO: () = { | |
10 | if false { | |
11 | // This bad constant is only used in dead code in a static initializer... and yet we still | |
12 | // must make sure that the build fails. | |
487cf647 | 13 | let _ = PrintName::<i32>::VOID; //~ constant |
17df50a5 XL |
14 | } |
15 | }; | |
16 | ||
17 | fn main() { | |
18 | FOO | |
19 | } |