summaryrefslogtreecommitdiffstats
path: root/src/test/ui/moves/move-out-of-slice-2.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/moves/move-out-of-slice-2.rs')
-rw-r--r--src/test/ui/moves/move-out-of-slice-2.rs35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/test/ui/moves/move-out-of-slice-2.rs b/src/test/ui/moves/move-out-of-slice-2.rs
new file mode 100644
index 000000000..59c02d42b
--- /dev/null
+++ b/src/test/ui/moves/move-out-of-slice-2.rs
@@ -0,0 +1,35 @@
+#![feature(unsized_locals)]
+//~^ WARN the feature `unsized_locals` is incomplete
+
+struct A;
+#[derive(Clone, Copy)]
+struct C;
+
+fn main() {
+ let a: Box<[A]> = Box::new([A]);
+ match *a {
+ //~^ ERROR cannot move out of type `[A]`, a non-copy slice
+ [a @ ..] => {}
+ _ => {}
+ }
+ let b: Box<[A]> = Box::new([A, A, A]);
+ match *b {
+ //~^ ERROR cannot move out of type `[A]`, a non-copy slice
+ [_, _, b @ .., _] => {}
+ _ => {}
+ }
+
+ // `[C]` isn't `Copy`, even if `C` is.
+ let c: Box<[C]> = Box::new([C]);
+ match *c {
+ //~^ ERROR cannot move out of type `[C]`, a non-copy slice
+ [c @ ..] => {}
+ _ => {}
+ }
+ let d: Box<[C]> = Box::new([C, C, C]);
+ match *d {
+ //~^ ERROR cannot move out of type `[C]`, a non-copy slice
+ [_, _, d @ .., _] => {}
+ _ => {}
+ }
+}