-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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, document, and test parser and pretty-printer edge cases related to braced macro calls #119427
Merged
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
b431eec
Expand on expr_requires_semi_to_be_stmt documentation
dtolnay cbb8714
Mark expr_requires_semi_to_be_stmt call sites
dtolnay 9e1cf20
Macro call with braces does not require semicolon to be statement
dtolnay c5a0eb1
Add ExprKind::MacCall statement boundary tests
dtolnay 7f2ffbd
Fix pretty printer statement boundaries after braced macro call
dtolnay d9bb733
Delete MacCall case from pretty-printing semicolon after StmtKind::Expr
dtolnay 0ca322c
Add test of unused_parens lint involving macro calls
dtolnay c6c18a0
Document the situation with unused_parens lint and braced macro calls
dtolnay 4a80865
Add parser tests for statement boundary insertion
dtolnay 8adcaf5
Mark Parser::expr_is_complete call sites
dtolnay 9dbe33d
Document MacCall special case in Parser::expr_is_complete
dtolnay 728e117
Document MacCall special case in Parser::parse_arm
dtolnay 0f6a51d
Add macro calls to else-no-if parser test
dtolnay aedc1b6
Remove MacCall special case from recovery after missing 'if' after 'e…
dtolnay 53521fa
Remove MacCall special cases from Parser::parse_full_stmt
dtolnay 10227ea
Add classify::expr_is_complete
dtolnay 78c8dc1
Fix redundant parens around braced macro call in match arms
dtolnay File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
why is this needed, if all the call sites are not calling this if
e ≈ MacCall
?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.
In the commit that adds this
MacCall
case insideexpr_requires_semi_to_be_stmt
, I change all the call sites to preserve their pre-existing behavior. So this case starts out as not reachable. But after that, one at a time for each call site, I update each call site that should be reaching this, together with adding documentation and tests for that call site.