mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-27 09:14:20 +00:00
21 lines
604 B
Rust
21 lines
604 B
Rust
// compile-flags: -O
|
|
//
|
|
|
|
#![crate_type = "lib"]
|
|
|
|
use std::iter;
|
|
|
|
// CHECK-LABEL: @repeat_take_collect
|
|
#[no_mangle]
|
|
pub fn repeat_take_collect() -> Vec<u8> {
|
|
// CHECK: call void @llvm.memset.{{.+}}({{i8\*|ptr}} {{.*}}align 1{{.*}} %{{[0-9]+}}, i8 42, i{{[0-9]+}} 100000, i1 false)
|
|
iter::repeat(42).take(100000).collect()
|
|
}
|
|
|
|
// CHECK-LABEL: @repeat_with_take_collect
|
|
#[no_mangle]
|
|
pub fn repeat_with_take_collect() -> Vec<u8> {
|
|
// CHECK: call void @llvm.memset.{{.+}}({{i8\*|ptr}} {{.*}}align 1{{.*}} %{{[0-9]+}}, i8 13, i{{[0-9]+}} 12345, i1 false)
|
|
iter::repeat_with(|| 13).take(12345).collect()
|
|
}
|