diff options
| author | Jakub Wieczorek <jakub@jakub.cc> | 2014-09-15 22:07:00 +0200 |
|---|---|---|
| committer | Jakub Wieczorek <jakub@jakub.cc> | 2014-09-15 22:24:14 +0200 |
| commit | c2a25a4a833221f4ddf68f46ef409abd2b20bf23 (patch) | |
| tree | a39b27aef900cbf82debeead6140001aa0fb5872 /src/test | |
| parent | a8d478db512803d25785a11c5b21634f8703b17f (diff) | |
| download | rust-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.rs | 18 |
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() { } |
