]> git.lizzy.rs Git - rust.git/blob - tests/ui/moves/move-out-of-slice-2.rs
Move /src/test to /tests
[rust.git] / tests / ui / moves / move-out-of-slice-2.rs
1 #![feature(unsized_locals)]
2 //~^ WARN the feature `unsized_locals` is incomplete
3 #![allow(unused)]
4
5 struct A;
6 #[derive(Clone, Copy)]
7 struct C;
8
9 fn main() {
10     let a: Box<[A]> = Box::new([A]);
11     match *a {
12         //~^ ERROR cannot move out of type `[A]`, a non-copy slice
13         [a @ ..] => {}
14         _ => {}
15     }
16     let b: Box<[A]> = Box::new([A, A, A]);
17     match *b {
18         //~^ ERROR cannot move out of type `[A]`, a non-copy slice
19         [_, _, b @ .., _] => {}
20         _ => {}
21     }
22
23     // `[C]` isn't `Copy`, even if `C` is.
24     let c: Box<[C]> = Box::new([C]);
25     match *c {
26         //~^ ERROR cannot move out of type `[C]`, a non-copy slice
27         [c @ ..] => {}
28         _ => {}
29     }
30     let d: Box<[C]> = Box::new([C, C, C]);
31     match *d {
32         //~^ ERROR cannot move out of type `[C]`, a non-copy slice
33         [_, _, d @ .., _] => {}
34         _ => {}
35     }
36 }