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

never_loop: don't emit AlwaysBreaks if it targets a block #9858

Merged
merged 3 commits into from
Nov 18, 2022

Conversation

kartva
Copy link
Contributor

@kartva kartva commented Nov 16, 2022

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

Introduced an ignored_ids parameter.
Takes O(n^2) time in the worst case.

Can be changed to collect block ids in first phase,
and then filter with binary search in second.
@rust-highfive
Copy link

r? @Jarcho

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Nov 16, 2022
@kartva
Copy link
Contributor Author

kartva commented Nov 17, 2022

r? @dswij

For continuity on the same issue.

@rust-highfive rust-highfive assigned dswij and unassigned Jarcho Nov 17, 2022
Copy link
Member

@dswij dswij left a 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!

@dswij
Copy link
Member

dswij commented Nov 18, 2022

@bors r+

@bors
Copy link
Collaborator

bors commented Nov 18, 2022

📌 Commit bc3cd34 has been approved by dswij

It is now in the queue for this repository.

@bors
Copy link
Collaborator

bors commented Nov 18, 2022

⌛ Testing commit bc3cd34 with merge 1c9c34d...

@bors
Copy link
Collaborator

bors commented Nov 18, 2022

☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test
Approved by: dswij
Pushing 1c9c34d to master...

@bors bors merged commit 1c9c34d into rust-lang:master Nov 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants