summaryrefslogtreecommitdiffstats
path: root/tests/ui/moves/move-into-dead-array-1.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/moves/move-into-dead-array-1.rs')
-rw-r--r--tests/ui/moves/move-into-dead-array-1.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/ui/moves/move-into-dead-array-1.rs b/tests/ui/moves/move-into-dead-array-1.rs
new file mode 100644
index 000000000..0b8d76def
--- /dev/null
+++ b/tests/ui/moves/move-into-dead-array-1.rs
@@ -0,0 +1,15 @@
+// Ensure that we cannot move into an uninitialized fixed-size array.
+
+struct D { _x: u8 }
+
+fn d() -> D { D { _x: 0 } }
+
+fn main() {
+ foo(1);
+ foo(3);
+}
+
+fn foo(i: usize) {
+ let mut a: [D; 4];
+ a[i] = d(); //~ ERROR E0381
+}