mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 14:55:26 +00:00
30 lines
492 B
Rust
30 lines
492 B
Rust
// 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);
|
|
}
|