From c2ef20fd38c5d52e1cf9416606140012ffa20217 Mon Sep 17 00:00:00 2001 From: Ulrik Sverdrup Date: Thu, 21 Apr 2016 21:35:39 +0200 Subject: [PATCH] specialize zip: Add codegen test --- src/test/codegen/zip.rs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 src/test/codegen/zip.rs diff --git a/src/test/codegen/zip.rs b/src/test/codegen/zip.rs new file mode 100644 index 00000000000..6c956364bf8 --- /dev/null +++ b/src/test/codegen/zip.rs @@ -0,0 +1,22 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// 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; + } +}