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

Rust: Various fixes to the CFG construction #17800

Merged
merged 18 commits into from
Oct 21, 2024

Conversation

paldepind
Copy link
Contributor

This PR fixes a bunch of inconsistencies in the CFG construction. This should reduce the number of CFG inconsistencies we see on real projects quite a bit.

Most of these are simple fixes and come with test cases and separate commits, so I won't describe them in detail. Please ask or comment if there's anything that's not clear.

@paldepind paldepind added the no-change-note-required This PR does not need a change note label Oct 18, 2024
@github-actions github-actions bot added the Rust Pull requests that update Rust code label Oct 18, 2024
@paldepind paldepind requested a review from hvitved October 21, 2024 06:32
@paldepind
Copy link
Contributor Author

According to the DCA results this PR seems to fix the vast majority of CFG inconsistencies. There's a few still left in some projects. I'll take a look at those as well and update the PR.

Copy link
Contributor

@hvitved hvitved left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, only one minor thing. Thanks a lot for structuring the PR into easy reviewable commits.

@@ -612,6 +612,8 @@ module PatternTrees {
result = rank[i + 1](Pat pat, int j | pat = this.getPat(j) | pat order by j)
}

predicate isEmpty() { not any(Pat p) = this.getPat(0) }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not exists(this.getPat(_)).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True. I realized that that was a bug, fixed in a later commit and after 6568eb8 it got removed as the behavior is now inherited from StandardTree.

@paldepind
Copy link
Contributor Author

I've updated the PR to fix the CI and add one more inconsistency fix (match expressions without arms) that I think should resolve the remaining inconsistencies that the DCA report showed.

@paldepind paldepind merged commit 5e4ce8f into github:main Oct 21, 2024
14 checks passed
@paldepind paldepind deleted the rust-cfg-fixes branch October 21, 2024 08:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no-change-note-required This PR does not need a change note Rust Pull requests that update Rust code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants