2023-04-05 03:44:20 -05:00
|
|
|
// ignore-wasm32 compiled with panic=abort by default
|
2022-04-13 04:20:46 -05:00
|
|
|
// unit-test: LowerSliceLenCalls
|
2021-06-20 09:09:42 -05:00
|
|
|
|
|
|
|
// 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]);
|
|
|
|
}
|