summaryrefslogtreecommitdiffstats
path: root/src/test/ui/consts/const-slice-oob.rs
blob: 35e5a4d2233feb11fa0a8cbdd2e26a77225e353d (plain)
1
2
3
4
5
6
7
8
9
10
11
#[deny(const_err)]

const FOO: &'static[u32] = &[1, 2, 3];
const BAR: u32 = FOO[5];
//~^ index out of bounds: the length is 3 but the index is 5
//~| ERROR any use of this value will cause an error
//~| WARN this was previously accepted by the compiler but is being phased out

fn main() {
    let _ = BAR;
}