about summary refs log tree commit diff
path: root/tests/codegen-llvm/slice-iter-fold.rs
blob: 55ab34661c36eee322f94d5f152089ec40464ef9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
//@ compile-flags: -Copt-level=3
#![crate_type = "lib"]

// CHECK-LABEL: @slice_fold_to_last
#[no_mangle]
pub fn slice_fold_to_last(slice: &[i32]) -> Option<&i32> {
    // CHECK-NOT: loop
    // CHECK-NOT: br
    // CHECK-NOT: call
    // CHECK: ret
    slice.iter().fold(None, |_, i| Some(i))
}