about summary refs log tree commit diff
path: root/tests/ui/for-loop-while/for-destruct.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/for-loop-while/for-destruct.rs')
-rw-r--r--tests/ui/for-loop-while/for-destruct.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/ui/for-loop-while/for-destruct.rs b/tests/ui/for-loop-while/for-destruct.rs
new file mode 100644
index 00000000000..7ca8d4ded25
--- /dev/null
+++ b/tests/ui/for-loop-while/for-destruct.rs
@@ -0,0 +1,9 @@
+// run-pass
+
+struct Pair { x: isize, y: isize }
+
+pub fn main() {
+    for elt in &(vec![Pair {x: 10, y: 20}, Pair {x: 30, y: 0}]) {
+        assert_eq!(elt.x + elt.y, 30);
+    }
+}