summaryrefslogtreecommitdiffstats
path: root/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.rs
blob: 266105c11f2cc662de0f51563b209adeefe82959 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// unit-test: ConstProp
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// EMIT_MIR_FOR_EACH_BIT_WIDTH

// EMIT_MIR bad_op_unsafe_oob_for_slices.main.ConstProp.diff
#[allow(unconditional_panic)]
fn main() {
    // CHECK-LABEL: fn main(
    // CHECK: debug a => [[a:_.*]];
    // CHECK: debug _b => [[b:_.*]];
    // CHECK: [[b]] = (*[[a]])[3 of 4];
    let a: *const [_] = &[1, 2, 3];
    unsafe {
        let _b = (*a)[3];
    }
}