about summary refs log tree commit diff
path: root/tests/ui/consts/const-err-late.rs
blob: 9cc2196a954ed6f81078a840e107a6c65e2dc85c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
//@ build-fail
//@ compile-flags: -C overflow-checks=on
//@ dont-require-annotations: NOTE

#![allow(arithmetic_overflow, unconditional_panic)]

fn black_box<T>(_: T) {
    unimplemented!()
}

struct S<T>(T);

impl<T> S<T> {
    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::<i32>::FOO, S::<u32>::FOO)); //~ NOTE constant
}