-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
fix never_loop false positive #9837
Conversation
on unconditional break to internal labeled block ref rust-lang#9831
r? @dswij (rust-highfive has picked a reviewer for you, use r? to override) |
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.
LGTM, thanks for this!
@bors r+ |
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
Note: pub fn test20() {
'a: loop {
'b: {
break 'a;
}
}
} Working on it! |
`never_loop`: don't emit AlwaysBreaks if it targets a block ref: #9837 (comment) The previous fix (#9837) was too simple and ignored all break commands inside a labelled block, regardless of whether their destination was a labelled block or a loop. This fix tracks all the labelled blocks in scope to ensure that only breaks targeting loops are considered. changelog: [`never_loop`]: prevent false negatives from `breaks` nested in labelled blocks
fixes #9831
changelog: [
never_loop
]: fixed false positive on unconditional break in internal labeled block