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: Improve CFG #17498

Merged
merged 28 commits into from
Sep 19, 2024
Merged

Rust: Improve CFG #17498

merged 28 commits into from
Sep 19, 2024

Conversation

paldepind
Copy link
Contributor

With this PR CFG creation is (attempted) to cover every relevant node in the AST. Some noteworthy additions are match expressions, closures, continue and break in loops (including with labels), if let expressions and short-circuiting binary operators.

I'm not aware of any syntax constructions that are not supported, but there probably are some bugs in there :)

@github-actions github-actions bot added the Rust Pull requests that update Rust code label Sep 17, 2024
}
}

class LogicalOrBinaryOpExprTree extends PreOrderTree instanceof BinaryExpr {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The short-circuiting operators are pre-ordered s.t. nested operators can be handled in a way where impossible paths are eliminated.

Copy link
Contributor

Choose a reason for hiding this comment

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

As discussed offline, this is fine for now, but we want to change this later to use splitting.

@paldepind paldepind self-assigned this Sep 17, 2024
@paldepind paldepind added the no-change-note-required This PR does not need a change note label Sep 18, 2024
geoffw0
geoffw0 previously approved these changes Sep 18, 2024
Copy link
Contributor

@geoffw0 geoffw0 left a comment

Choose a reason for hiding this comment

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

Looks very promising!

there probably are some bugs in there :)

Hopefully when we have consistency checks and actual queries depending on this we'll discover any issues quite rapidly.

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.

Really great work, Simon!

@paldepind
Copy link
Contributor Author

The PR is ready for re-review.

I've addressed most of the comments. I didn't fix the match/no-match edges going out of let statements. I don't understand yet why they're not picked up by the trivialPat predicate, but we can investigate that later I think :)

@hvitved
Copy link
Contributor

hvitved commented Sep 19, 2024

The PR is ready for re-review.

I don't understand why the CFGs for test_nested_if and test_nested_if_match are gone in the merge commit?

@paldepind
Copy link
Contributor Author

You're right, I didn't notice that. It could be due to the changes in the extractor or maybe some of the last changes I made broke it. Let's investigate after merging :)

@paldepind paldepind merged commit 95c18ce into github:main Sep 19, 2024
14 checks passed
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.

3 participants