2018-08-30 14:18:55 +02:00
|
|
|
//@ run-pass
|
|
|
|
|
2015-02-03 17:44:16 +01:00
|
|
|
// Ensure that we can copy out of a fixed-size array.
|
|
|
|
//
|
2020-12-28 20:15:16 +03:00
|
|
|
// (Compare with ui/moves/move-out-of-array-1.rs)
|
2015-02-03 17:44:16 +01:00
|
|
|
|
2015-03-30 09:38:27 -04:00
|
|
|
#[derive(Copy, Clone)]
|
2015-02-03 17:44:16 +01:00
|
|
|
struct C { _x: u8 }
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
fn d() -> C { C { _x: 0 } }
|
|
|
|
|
|
|
|
let _d1 = foo([d(), d(), d(), d()], 1);
|
|
|
|
let _d3 = foo([d(), d(), d(), d()], 3);
|
|
|
|
}
|
|
|
|
|
|
|
|
fn foo(a: [C; 4], i: usize) -> C {
|
|
|
|
a[i]
|
|
|
|
}
|