Add a lint pass to check for while true { ... } loops

And suggest changing them to loop { ... }. Had to fix the few
remaining while true loops (in core::io). Closes #1962.
This commit is contained in:
Tim Chevalier 2012-04-19 18:04:41 -07:00
parent 594d22e7e2
commit cdc8722f95
3 changed files with 47 additions and 5 deletions

View file

@ -0,0 +1,8 @@
// compile-flags: -W err-while-true
fn main() {
let mut i = 0;
while true { //! ERROR Denote infinite loops with loop
i += 1;
if i == 5 { break; }
}
}