2 // compile-flags: -O -C panic=abort
5 fn search<T: Ord + Eq>(arr: &mut [T], a: &T) -> Result<usize, ()> {
6 match arr.iter().position(|x| x == a) {
14 // CHECK-LABEL: @position_no_bounds_check
16 pub fn position_no_bounds_check(y: &mut [u32], x: &u32, z: &u32) -> bool {
17 // This contains "call assume" so we cannot just rule out all calls
18 // CHECK-NOT: panic_bounds_check
19 if let Ok(p) = search(y, x) {
26 // just to make sure that panicking really emits "panic_bounds_check" somewhere in the IR
27 // CHECK-LABEL: @test_check
29 pub fn test_check(y: &[i32]) -> i32 {
30 // CHECK: panic_bounds_check