-
Notifications
You must be signed in to change notification settings - Fork 13.5k
loop match: error on #[const_continue]
outside #[loop_match]
#143360
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
base: master
Are you sure you want to change the base?
loop match: error on #[const_continue]
outside #[loop_match]
#143360
Conversation
rustbot has assigned @WaffleLapkin. Use |
#[const_continue] | ||
break State::A; | ||
//~^ ERROR unlabeled `break` inside of a labeled block | ||
//~| ERROR mismatched types |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is mismatched types coming from?..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the break
is seen as a break from the loop with a value, and it's the final expression, so that value is returned, but the function's type says it'll return unit.
8f4ff04
to
771373e
Compare
771373e
to
7d0caef
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Turns out there was a better way to do this at a much earlier stage. The logic now also properly handles shadowing labels (where the outer one is part of a loop_match
but the inner one is not).
@rustbot ready
tracking issue #132306
fixes #143119
fixes #143165
Fixes two ICEs because a panic was reachable.
@rustbot label +F-loop_match