]> git.lizzy.rs Git - rust.git/blob - tests/ui/array-slice-vec/copy-out-of-array-1.rs
Auto merge of #105716 - chriswailes:ndk-update-redux, r=pietroalbini
[rust.git] / tests / ui / array-slice-vec / copy-out-of-array-1.rs
1 // run-pass
2
3 // Ensure that we can copy out of a fixed-size array.
4 //
5 // (Compare with ui/moves/move-out-of-array-1.rs)
6
7 #[derive(Copy, Clone)]
8 struct C { _x: u8 }
9
10 fn main() {
11     fn d() -> C { C { _x: 0 } }
12
13     let _d1 = foo([d(), d(), d(), d()], 1);
14     let _d3 = foo([d(), d(), d(), d()], 3);
15 }
16
17 fn foo(a: [C; 4], i: usize) -> C {
18     a[i]
19 }