]> git.proxmox.com Git - rustc.git/blob - tests/mir-opt/lower_slice_len.rs
New upstream version 1.70.0+dfsg1
[rustc.git] / tests / mir-opt / lower_slice_len.rs
1 // ignore-wasm32 compiled with panic=abort by default
2 // unit-test: LowerSliceLenCalls
3
4 // EMIT_MIR lower_slice_len.bound.LowerSliceLenCalls.diff
5 pub fn bound(index: usize, slice: &[u8]) -> u8 {
6 if index < slice.len() {
7 slice[index]
8 } else {
9 42
10 }
11 }
12
13 fn main() {
14 let _ = bound(1, &[1, 2, 3]);
15 }