about summary refs log tree commit diff
path: root/tests/ui/moves/move-out-of-tuple-field.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/moves/move-out-of-tuple-field.rs')
-rw-r--r--tests/ui/moves/move-out-of-tuple-field.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/ui/moves/move-out-of-tuple-field.rs b/tests/ui/moves/move-out-of-tuple-field.rs
new file mode 100644
index 00000000000..66912fa4d09
--- /dev/null
+++ b/tests/ui/moves/move-out-of-tuple-field.rs
@@ -0,0 +1,13 @@
+struct Foo(Box<isize>);
+
+
+
+fn main() {
+    let x: (Box<_>,) = (Box::new(1),);
+    let y = x.0;
+    let z = x.0; //~ ERROR use of moved value: `x.0`
+
+    let x = Foo(Box::new(1));
+    let y = x.0;
+    let z = x.0; //~ ERROR use of moved value: `x.0`
+}