]> git.lizzy.rs Git - rust.git/blob - tests/mir-opt/lower_slice_len.rs
Rollup merge of #107473 - rustbot:docs-update, r=ehuss
[rust.git] / tests / mir-opt / lower_slice_len.rs
1 // unit-test: LowerSliceLenCalls
2
3 // EMIT_MIR lower_slice_len.bound.LowerSliceLenCalls.diff
4 pub fn bound(index: usize, slice: &[u8]) -> u8 {
5     if index < slice.len() {
6         slice[index]
7     } else {
8         42
9     }
10 }
11
12 fn main() {
13     let _ = bound(1, &[1, 2, 3]);
14 }