2024-04-20 06:19:34 -05:00
|
|
|
//@ test-mir-pass: LowerSliceLenCalls
|
2023-10-16 15:03:43 -05:00
|
|
|
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
|
2021-06-20 09:09:42 -05:00
|
|
|
|
|
|
|
// EMIT_MIR lower_slice_len.bound.LowerSliceLenCalls.diff
|
|
|
|
pub fn bound(index: usize, slice: &[u8]) -> u8 {
|
2023-10-16 15:03:43 -05:00
|
|
|
// CHECK-LABEL: fn bound(
|
|
|
|
// CHECK-NOT: ::len(
|
2024-06-02 19:18:33 -05:00
|
|
|
if index < slice.len() { slice[index] } else { 42 }
|
2021-06-20 09:09:42 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let _ = bound(1, &[1, 2, 3]);
|
|
|
|
}
|