Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
catamorphism opened this issue Dec 7, 2012 · 7 comments
Closed

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

catamorphism opened this issue Dec 7, 2012 · 7 comments
Labels
A-codegen Area: Code generation

Comments

@catamorphism
Copy link
Contributor

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

e.g.

loop foo: {
    for whatever() |x| {
         break foo;
    }
}
// ...
@nikomatsakis
Copy link
Contributor

Not critical for 0.6; removing milestone

@catamorphism
Copy link
Contributor Author

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

@nikomatsakis
Copy link
Contributor

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
Copy link
Contributor Author

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

@graydon
Copy link
Contributor

graydon commented May 16, 2013

accepted for feature-complete milestone

@thestinger
Copy link
Contributor

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

@thestinger
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-codegen Area: Code generation
Projects
None yet
Development

No branches or pull requests

4 participants