You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
letmut a;loop{
a = 1;// ... break ...}do_something(a)
is valid but the while true equivalent is not: the compiler isn't sure that a is initialised. Of course, this is just a minor detail, we could special case the while true form like Java.
Language changes such as this require and RFC rather than an issue in the rust repository, I would recommend following the procedure over at https://github.com/rust-lang/rfcs.
@alexcrichton Obviously requires an RFC. I'm much appreciate if someone has interest writing it. (I'm not a native-english user, too hard to write it for me, sorry.)
@pnkfelix@Thiez We can do more if we want to remove or replace it.
I'd like to take up replacing the loop keyword with while true. Now that #12643 is fixed, this should be straightforward. It looks like we can recognize the two tokens while true in the parser and invoke the existing loop parsing machinery with very minimal changes. This allows us to remove loop before Rust 1.0 is frozen, and the internal implementation can be cleaned up at any later time.
I am willing to do the work of replacing all occurrences of loop with while true in the source and documentation, but I will need help actually modifying the compiler. This is my first real change to Rust and first RFC, so I would love advice and input.
Also, if anyone can point me to an easy way to mechanically transform Rust source, I might make a tool to help with migration.
Activity
liigo commentedon Mar 17, 2014
cc #2233: Remove
whileloopshuonw commentedon Mar 17, 2014
loopdoes currently have a special job:is valid but the
while trueequivalent is not: the compiler isn't sure thatais initialised. Of course, this is just a minor detail, we could special case thewhile trueform like Java.alexcrichton commentedon Mar 17, 2014
Language changes such as this require and RFC rather than an issue in the rust repository, I would recommend following the procedure over at https://github.com/rust-lang/rfcs.
pnkfelix commentedon Mar 17, 2014
Also, we definitely cannot remove
loop-de-loops until #12643 is fixed.Thiez commentedon Mar 17, 2014
loopcould not be replaced bywhile {stuff}because{stuff}would be interpreted as the condition (e.g.while { condition } { body }).liigo commentedon Mar 20, 2014
@alexcrichton Obviously requires an RFC. I'm much appreciate if someone has interest writing it. (I'm not a native-english user, too hard to write it for me, sorry.)
@pnkfelix @Thiez We can do more if we want to remove or replace it.
First pass at replacing `loop` with `while true`.
jkleint commentedon Nov 2, 2014
I'd like to take up replacing the
loopkeyword withwhile true. Now that #12643 is fixed, this should be straightforward. It looks like we can recognize the two tokenswhile truein the parser and invoke the existing loop parsing machinery with very minimal changes. This allows us to removeloopbefore Rust 1.0 is frozen, and the internal implementation can be cleaned up at any later time.I have a rough pass at an RFC up here:
https://github.com/jkleint/rfcs/blob/remove-loop-keyword/text/0000-remove-loop-keyword.md
I am requesting comments on my Request For Comments.
I am willing to do the work of replacing all occurrences of
loopwithwhile truein the source and documentation, but I will need help actually modifying the compiler. This is my first real change to Rust and first RFC, so I would love advice and input.Also, if anyone can point me to an easy way to mechanically transform Rust source, I might make a tool to help with migration.
Thanks!
liigo commentedon Nov 4, 2014
@jkleint thank you for working on this!
Auto merge of rust-lang#13028 - yue4u:fix/literal-lookup, r=jonas-sch…