mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 23:04:33 +00:00
15 lines
272 B
Rust
15 lines
272 B
Rust
// 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]);
|
|
}
|