about summary refs log tree commit diff
path: root/src/test/compile-fail/liveness-move-in-while.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/compile-fail/liveness-move-in-while.rs')
-rw-r--r--src/test/compile-fail/liveness-move-in-while.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/test/compile-fail/liveness-move-in-while.rs b/src/test/compile-fail/liveness-move-in-while.rs
new file mode 100644
index 00000000000..6acbc5a9f35
--- /dev/null
+++ b/src/test/compile-fail/liveness-move-in-while.rs
@@ -0,0 +1,11 @@
+fn main() {
+
+    let y: int = 42;
+    let mut x: int;
+    loop {
+        log(debug, y);
+        while true { while true { while true { x <- y; } } }
+        //!^ ERROR use of moved variable: `y`
+        //!^^ NOTE move of variable occurred here
+    }
+}