summaryrefslogtreecommitdiffstats
path: root/src/test/ui/for-loop-while/for-destruct.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/for-loop-while/for-destruct.rs')
-rw-r--r--src/test/ui/for-loop-while/for-destruct.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/test/ui/for-loop-while/for-destruct.rs b/src/test/ui/for-loop-while/for-destruct.rs
new file mode 100644
index 000000000..7ca8d4ded
--- /dev/null
+++ b/src/test/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);
+ }
+}