blob: f335e92c3dc446a2dc82565b8f34e8a8d647d948 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
// compile-flags: -O
// min-llvm-version: 16
#![crate_type = "lib"]
#[no_mangle]
pub fn test() -> u32 {
// CHECK-LABEL: @test(
// CHECK: ret i32 13
let s = [1, 2, 3, 4, 5, 6, 7];
let mut iter = s.iter();
let mut sum = 0;
while let Some(_) = iter.next() {
sum += iter.next().map_or(1, |&x| x)
}
sum
}
|