]> git.lizzy.rs Git - rust.git/blob - tests/codegen/repeat-trusted-len.rs
Rollup merge of #107731 - RalfJung:interpret-discriminant, r=cjgillot
[rust.git] / tests / codegen / repeat-trusted-len.rs
1 // compile-flags: -O
2 //
3
4 #![crate_type = "lib"]
5
6 use std::iter;
7
8 // CHECK-LABEL: @repeat_take_collect
9 #[no_mangle]
10 pub fn repeat_take_collect() -> Vec<u8> {
11 // CHECK: call void @llvm.memset.{{.+}}({{i8\*|ptr}} {{.*}}align 1{{.*}} %{{[0-9]+}}, i8 42, i{{[0-9]+}} 100000, i1 false)
12     iter::repeat(42).take(100000).collect()
13 }
14
15 // CHECK-LABEL: @repeat_with_take_collect
16 #[no_mangle]
17 pub fn repeat_with_take_collect() -> Vec<u8> {
18 // CHECK: call void @llvm.memset.{{.+}}({{i8\*|ptr}} {{.*}}align 1{{.*}} %{{[0-9]+}}, i8 13, i{{[0-9]+}} 12345, i1 false)
19     iter::repeat_with(|| 13).take(12345).collect()
20 }