blob: 8064cc49359eef4c36681f53155d2295c4e846c8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
// build-fail
// Regression test for #66975
#![warn(const_err, unconditional_panic)]
#![feature(never_type)]
struct PrintName<T>(T);
impl<T> PrintName<T> {
const VOID: ! = { let x = 0 * std::mem::size_of::<T>(); [][x] };
//~^ WARN any use of this value will cause an error
//~| WARN this was previously accepted by the compiler but is being phased out
}
fn f<T>() {
let _ = PrintName::<T>::VOID;
//~^ ERROR erroneous constant encountered
}
pub fn main() {
f::<()>();
}
|