]> git.lizzy.rs Git - rust.git/commitdiff
Auto merge of #50763 - KyleStach1678:unused-loop-label, r=petrochenkov
authorbors <bors@rust-lang.org>
Sat, 19 May 2018 14:52:30 +0000 (14:52 +0000)
committerbors <bors@rust-lang.org>
Sat, 19 May 2018 14:52:30 +0000 (14:52 +0000)
Add lint checks for unused loop labels

Previously no warning was generated when a loop label was written out but never used (i.e. in a `break` or `continue` statement):
```rust
fn main() {
    'unused_label: loop {}
}
```
would compile without complaint.

This fix introduces `-W unused_loop_label`, which generates the following warning message for the above snippet:
```
warning: unused loop label
 --> main.rs:2:5
  |
2 |     'unused_label: loop {}
  |     ^^^^^^^^^^^^^
  |
  = note: #[warn(unused_loop_label)] on by default
```

Fixes: #50751.
1  2 
src/librustc/lint/builtin.rs
src/librustc_lint/lib.rs
src/librustc_resolve/lib.rs

Simple merge
Simple merge
Simple merge