Can't break to a labeled loop from inside a for loop #4131

catamorphism opened this Issue Dec 7, 2012 · 7 comments


None yet
4 participants

catamorphism commented Dec 7, 2012

Because for loop bodies are closures, implementing this case is a PITA. I haven't done it yet.


loop foo: {
    for whatever() |x| {
         break foo;
// ...

nikomatsakis commented Mar 25, 2013

Not critical for 0.6; removing milestone


catamorphism commented May 14, 2013

Nominating for milestone 1 (well-defined) so we can discuss whether we actually want to support this.


nikomatsakis commented May 16, 2013

I see no reason not to support this. If we can return from the calling function, we can also break to a label. I do see reasons to defer implementing it. :) In particular, I'd like to revisit our label syntax to use lifetime names (which would also give users a way to name the lifetime associated with a block or expression, and resolve the parsing issues we encountered before, since lifetime names are their own kind of token).


catamorphism commented May 16, 2013

In that case, nominating for milestone 3 (feature-complete) instead.


graydon commented May 16, 2013

accepted for feature-complete milestone


thestinger commented Jul 6, 2013

#6997 is related because this will be trivial when we replace the current for loop


thestinger commented Aug 2, 2013

The old for loop is being removed, foreach has landed as a replacement.

thestinger closed this Aug 2, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment