diff options
Diffstat (limited to 'src/test/codegen/zip.rs')
-rw-r--r-- | src/test/codegen/zip.rs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/test/codegen/zip.rs b/src/test/codegen/zip.rs new file mode 100644 index 000000000..e55f4f1a2 --- /dev/null +++ b/src/test/codegen/zip.rs @@ -0,0 +1,21 @@ +// compile-flags: -C no-prepopulate-passes -O + +#![crate_type = "lib"] + +// CHECK-LABEL: @zip_copy +#[no_mangle] +pub fn zip_copy(xs: &[u8], ys: &mut [u8]) { +// CHECK: memcpy + for (x, y) in xs.iter().zip(ys) { + *y = *x; + } +} + +// CHECK-LABEL: @zip_copy_mapped +#[no_mangle] +pub fn zip_copy_mapped(xs: &[u8], ys: &mut [u8]) { +// CHECK: memcpy + for (x, y) in xs.iter().map(|&x| x).zip(ys) { + *y = x; + } +} |