rust-lang/rust — pull request #18553 by jkleint (2014-11-02 23:29:14+00:00)
Title: First pass at replacing `loop` with `while true`.

Proto-RFC here: https://github.com/jkleint/rfcs/blob/remove-loop-keyword/text/0000-remove-loop-keyword.md

This is my first foray into modifying the Rust compiler, so please let me know if I'm way off the mark. I'm not sure this is the right way to do things, it's just to get the conversation started and show it may be simple.

This piggybacks on while-expression parsing the same way as `while let` to recognize `while true` and call the existing `loop` parsing code.

I haven't been able to thoroughly test it, but it does seem to compile code like this:

```
fn main() {
let x;
while true { x = 1i; break; }
println!("{}", x)
}
```
which previously did not compile (`x` possibly uninitialized).

I'm unsure of how to use the existing deprecation machinery for a keyword, so I have just put in placeholder warnings, but please advise on how do do that properly. I'm also not sure if the source span properly encompasses the whole while loop.

Fixes #12975.