about summary refs log tree commit diff
path: root/src/test/codegen
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2017-03-09 08:26:17 +0000
committerbors <bors@rust-lang.org>2017-03-09 08:26:17 +0000
commit3087a1f39eaeac9d76c8b159dcc64de515bb2b83 (patch)
treebace37e5277d56098ee4d1bb0727d930d68b650c /src/test/codegen
parent5c9208faf1f180cd15cf93f74f1e57b24856d11e (diff)
parentf2886e8bda7d628ae0cc16e4fe579cbc2c6dc1b0 (diff)
downloadrust-3087a1f39eaeac9d76c8b159dcc64de515bb2b83.tar.gz
rust-3087a1f39eaeac9d76c8b159dcc64de515bb2b83.zip
Auto merge of #40368 - arielb1:rollup, r=arielb1
Rollup of 20 pull requests

- Successful merges: #40154, #40222, #40226, #40237, #40254, #40258, #40265, #40268, #40279, #40283, #40292, #40293, #40296, #40316, #40321, #40325, #40326, #40327, #40333, #40335
- Failed merges:
Diffstat (limited to 'src/test/codegen')
-rw-r--r--src/test/codegen/issue-15953.rs39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/test/codegen/issue-15953.rs b/src/test/codegen/issue-15953.rs
new file mode 100644
index 00000000000..320ea6b5cc4
--- /dev/null
+++ b/src/test/codegen/issue-15953.rs
@@ -0,0 +1,39 @@
+// Copyright 2017 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 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// Test that llvm generates `memcpy` for moving a value
+// inside a function and moving an argument.
+
+struct Foo {
+    x: Vec<i32>,
+}
+
+#[inline(never)]
+#[no_mangle]
+// CHECK: memcpy
+fn interior(x: Vec<i32>) -> Vec<i32> {
+    let Foo { x } = Foo { x: x };
+    x
+}
+
+#[inline(never)]
+#[no_mangle]
+// CHECK: memcpy
+fn exterior(x: Vec<i32>) -> Vec<i32> {
+    x
+}
+
+fn main() {
+    let x = interior(Vec::new());
+    println!("{:?}", x);
+
+    let x = exterior(Vec::new());
+    println!("{:?}", x);
+}