summaryrefslogtreecommitdiffstats
path: root/src/test/ui/consts/const-eval/index-out-of-bounds-never-type.rs
blob: bc2ea3f18faf225e158b52bf218a596b77b3bc0b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// build-fail

// Regression test for #66975
#![warn(unconditional_panic)]
#![feature(never_type)]

struct PrintName<T>(T);

impl<T> PrintName<T> {
    const VOID: ! = { let x = 0 * std::mem::size_of::<T>(); [][x] };
    //~^ ERROR evaluation of `PrintName::<()>::VOID` failed

}

fn f<T>() {
    let _ = PrintName::<T>::VOID;
}

pub fn main() {
    f::<()>();
}