diff options
| author | Ariel Ben-Yehuda <arielb1@mail.tau.ac.il> | 2017-03-08 20:54:01 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-03-08 20:54:01 +0200 |
| commit | 37faa60d8e1a8e10e9d3bb78e70e74434f600bc7 (patch) | |
| tree | fe8001de135a2578f834a71bf65482bd81c64f81 /src/test/codegen | |
| parent | d4eb25cf0eb4c75c72eea8249b5dfaaabbbbf4a4 (diff) | |
| parent | 7dc36e9d9991608c59ac9e40e89573318cd08b74 (diff) | |
| download | rust-37faa60d8e1a8e10e9d3bb78e70e74434f600bc7.tar.gz rust-37faa60d8e1a8e10e9d3bb78e70e74434f600bc7.zip | |
Rollup merge of #40296 - topecongiro:add-missing-tests, r=alexcrichton
Add tests for issues with the 'E-needtest' label. This PR adds tests for the following issues:
Diffstat (limited to 'src/test/codegen')
| -rw-r--r-- | src/test/codegen/issue-15953.rs | 39 |
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); +} |
