]> git.lizzy.rs Git - rust.git/blob - src/test/ui/consts/const-eval/index-out-of-bounds-never-type.rs
Auto merge of #81132 - bugadani:map-prealloc, r=matthewjasper
[rust.git] / src / test / ui / consts / const-eval / index-out-of-bounds-never-type.rs
1 // build-fail
2
3 // Regression test for #66975
4 #![warn(const_err, unconditional_panic)]
5 #![feature(never_type)]
6
7 struct PrintName<T>(T);
8
9 impl<T> PrintName<T> {
10     const VOID: ! = { let x = 0 * std::mem::size_of::<T>(); [][x] };
11     //~^ WARN any use of this value will cause an error
12     //~| WARN this was previously accepted by the compiler but is being phased out
13
14 }
15
16 fn f<T>() {
17     let _ = PrintName::<T>::VOID;
18     //~^ ERROR erroneous constant encountered
19 }
20
21 pub fn main() {
22     f::<()>();
23 }