// build-fail // Regression test for #66975 #![warn(const_err, unconditional_panic)] #![feature(never_type)] struct PrintName(T); impl PrintName { const VOID: ! = { let x = 0 * std::mem::size_of::(); [][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() { let _ = PrintName::::VOID; //~^ ERROR erroneous constant encountered } pub fn main() { f::<()>(); }