summaryrefslogtreecommitdiffstats
path: root/tests/mir-opt/lower_slice_len.rs
blob: b0c512aec89d2f5096a8811a097508ea384207b4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// unit-test: LowerSliceLenCalls

// EMIT_MIR lower_slice_len.bound.LowerSliceLenCalls.diff
pub fn bound(index: usize, slice: &[u8]) -> u8 {
    if index < slice.len() {
        slice[index]
    } else {
        42
    }
}

fn main() {
    let _ = bound(1, &[1, 2, 3]);
}