summaryrefslogtreecommitdiffstats
path: root/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.rs
blob: 7931c4f02ae6795ca4ba11525d518951799c122d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
// unit-test: ConstProp
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// compile-flags: -Zmir-enable-passes=+NormalizeArrayLen

// EMIT_MIR_FOR_EACH_BIT_WIDTH
// EMIT_MIR bad_op_unsafe_oob_for_slices.main.ConstProp.diff
#[allow(unconditional_panic)]
fn main() {
    let a: *const [_] = &[1, 2, 3];
    unsafe {
        let _b = (*a)[3];
    }
}