]> git.proxmox.com Git - rustc.git/blame - tests/ui/consts/const-eval/erroneous-const2.rs
New upstream version 1.68.2+dfsg1
[rustc.git] / tests / ui / consts / const-eval / erroneous-const2.rs
CommitLineData
17df50a5 1//! Make sure we error on erroneous consts even if they are unused.
2b03887a 2#![allow(unconditional_panic)]
17df50a5
XL
3
4struct PrintName<T>(T);
5impl<T> PrintName<T> {
2b03887a 6 const VOID: () = [()][2]; //~ERROR evaluation of `PrintName::<i32>::VOID` failed
17df50a5
XL
7}
8
9pub 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
17fn main() {
18 FOO
19}