//@ build-fail //@ compile-flags: -C overflow-checks=on //@ dont-require-annotations: NOTE #![allow(arithmetic_overflow, unconditional_panic)] fn black_box(_: T) { unimplemented!() } struct S(T); impl S { const FOO: u8 = [5u8][1]; //~^ ERROR index out of bounds: the length is 1 but the index is 1 //~| ERROR index out of bounds: the length is 1 but the index is 1 } fn main() { black_box((S::::FOO, S::::FOO)); //~ NOTE constant }