diff options
| author | bors <bors@rust-lang.org> | 2022-11-27 00:58:50 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-11-27 00:58:50 +0000 |
| commit | faf1891deb2633fe4040de8b71fd7b2045c45dc5 (patch) | |
| tree | baf896d46501fa2b94a56210391db2523a791748 /src/test/codegen | |
| parent | c0e9c86b3f3e96267ba2cd80f95f362ef0cce40b (diff) | |
| parent | 9d68a1a74c65245c9ae7b5db2c552c995697e8ef (diff) | |
| download | rust-faf1891deb2633fe4040de8b71fd7b2045c45dc5.tar.gz rust-faf1891deb2633fe4040de8b71fd7b2045c45dc5.zip | |
Auto merge of #104818 - scottmcm:refactor-extend-func, r=the8472
Stop peeling the last iteration of the loop in `Vec::resize_with` `resize_with` uses the `ExtendWith` code that peels the last iteration: https://github.com/rust-lang/rust/blob/341d8b8a2c290b4535e965867e876b095461ff6e/library/alloc/src/vec/mod.rs#L2525-L2529 But that's kinda weird for `ExtendFunc` because it does the same thing on the last iteration anyway: https://github.com/rust-lang/rust/blob/341d8b8a2c290b4535e965867e876b095461ff6e/library/alloc/src/vec/mod.rs#L2494-L2502 So this just has it use the normal `extend`-from-`TrustedLen` code instead. r? `@ghost`
Diffstat (limited to 'src/test/codegen')
| -rw-r--r-- | src/test/codegen/repeat-trusted-len.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/test/codegen/repeat-trusted-len.rs b/src/test/codegen/repeat-trusted-len.rs index 7aebd3ec7df..87c8fe1354d 100644 --- a/src/test/codegen/repeat-trusted-len.rs +++ b/src/test/codegen/repeat-trusted-len.rs @@ -11,3 +11,10 @@ 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() +} |
