about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorJakub Wieczorek <jakub@jakub.cc>2014-09-15 22:07:00 +0200
committerJakub Wieczorek <jakub@jakub.cc>2014-09-15 22:24:14 +0200
commitc2a25a4a833221f4ddf68f46ef409abd2b20bf23 (patch)
treea39b27aef900cbf82debeead6140001aa0fb5872 /src/test
parenta8d478db512803d25785a11c5b21634f8703b17f (diff)
downloadrust-c2a25a4a833221f4ddf68f46ef409abd2b20bf23.tar.gz
rust-c2a25a4a833221f4ddf68f46ef409abd2b20bf23.zip
Add missing unused variable warnings for for loop bindings
Diffstat (limited to 'src/test')
-rw-r--r--src/test/compile-fail/liveness-unused.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/test/compile-fail/liveness-unused.rs b/src/test/compile-fail/liveness-unused.rs
index 68dbacaae5c..41a30e23b22 100644
--- a/src/test/compile-fail/liveness-unused.rs
+++ b/src/test/compile-fail/liveness-unused.rs
@@ -82,5 +82,23 @@ fn f4b() -> int {
     }
 }
 
+fn f5a() {
+    for x in range(1i, 10) { }
+    //~^ ERROR unused variable: `x`
+}
+
+fn f5b() {
+    for (x, _) in [1i, 2, 3].iter().enumerate() { }
+    //~^ ERROR unused variable: `x`
+}
+
+fn f5c() {
+    for (_, x) in [1i, 2, 3].iter().enumerate() {
+    //~^ ERROR unused variable: `x`
+        continue;
+        std::os::set_exit_status(*x); //~ WARNING unreachable statement
+    }
+}
+
 fn main() {
 }