add codegen test for slice::Iter::fold
This commit is contained in:
parent
d89e458159
commit
ba5b2f0b4b
14
tests/codegen/slice-iter-fold.rs
Normal file
14
tests/codegen/slice-iter-fold.rs
Normal file
@ -0,0 +1,14 @@
|
||||
// ignore-debug: the debug assertions get in the way
|
||||
// compile-flags: -O
|
||||
// min-llvm-version: 16
|
||||
#![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))
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user