2 // ignore-debug: the debug assertions get in the way
5 // Make sure no bounds checks are emitted when slicing or indexing
6 // with an index from `binary_search`.
8 // CHECK-LABEL: @binary_search_index_no_bounds_check
10 pub fn binary_search_index_no_bounds_check(s: &[u8]) -> u8 {
12 // CHECK-NOT: slice_index_len_fail
13 if let Ok(idx) = s.binary_search(&b'\\') {
20 // Similarly, check that `partition_point` is known to return a valid fencepost.
22 // CHECK-LABEL: @unknown_split
24 pub fn unknown_split(x: &[i32], i: usize) -> (&[i32], &[i32]) {
25 // This just makes sure that the subsequent function is looking for the
26 // absence of something that might actually be there.
28 // CHECK: call core::panicking::panic
32 // CHECK-LABEL: @partition_point_split_no_bounds_check
34 pub fn partition_point_split_no_bounds_check(x: &[i32], needle: i32) -> (&[i32], &[i32]) {
35 // CHECK-NOT: call core::panicking::panic
36 let i = x.partition_point(|p| p < &needle);