-
Notifications
You must be signed in to change notification settings - Fork 1.6k
[never_loop] Fix #10304 #10311
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
[never_loop] Fix #10304 #10311
Conversation
r? @Jarcho (rustbot has picked a reviewer for you, use r? to override) |
82db08b
to
2d98685
Compare
Overall looks good. While you're at changing this you can remove |
Indeed, will do. |
346a9f2
to
758e4ce
Compare
It is ready now. I first removed |
`combine_seq(x, NeverLoopResult::Otherwise)` always returns `x`
All evaluations now happen in order.
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.
Took a closer second look at this and there are a few things which need to be fixed.
The following code ``` loop { 'a: { { } break 'a; } } ``` was detected as a never-looping loop.
It is not sufficient to ignore break from a block inside the loop. Instructions after the break must be ignored, as they are unreachable. This is also true for all instructions in outer blocks and loops until the right block is reached.
758e4ce
to
657ee48
Compare
All looks good. Thanks for the fix. @bors r+ |
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
It is not sufficient to ignore break from a block inside the loop. Instructions after the break must be ignored, as they are unreachable. This is also true for all instructions in outer blocks and loops until the right block is reached.
Fixes #10304
changelog: FP: [
never_loop
]: No longer lints, for statements following break statements for outer blocks.#10311