Give types to some bool function arguments in pretty printer#92243
Closed
dtolnay wants to merge 1 commit intorust-lang:masterfrom
Closed
Give types to some bool function arguments in pretty printer#92243dtolnay wants to merge 1 commit intorust-lang:masterfrom
dtolnay wants to merge 1 commit intorust-lang:masterfrom
Conversation
Contributor
|
r? @estebank (rust-highfive has picked a reviewer for you, use r? to override) |
This comment has been minimized.
This comment has been minimized.
Collaborator
|
☔ The latest upstream changes (presumably #92397) made this pull request unmergeable. Please resolve the merge conflicts. |
Member
Author
|
Collaborator
|
☔ The latest upstream changes (presumably #92664) made this pull request unmergeable. Please resolve the merge conflicts. |
Member
Author
|
Collaborator
|
The job Click to see the possible cause of the failure (guessed by this bot) |
Member
Author
|
Blocked by compiler/rustc_ast_pretty/src/pprust/state.rs being over the 3000 lines |
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this pull request
Jan 15, 2022
Move expr- and item-related pretty printing functions to modules Currently *compiler/rustc_ast_pretty/src/pprust/state.rs* is 2976 lines on master. The `tidy` limit is 3000, which is blocking rust-lang#92243. This PR adds a `mod expr;` and `mod item;` to move logic related to those AST nodes out of the single huge file.
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this pull request
Jan 19, 2022
Move expr- and item-related pretty printing functions to modules Currently *compiler/rustc_ast_pretty/src/pprust/state.rs* is 2976 lines on master. The `tidy` limit is 3000, which is blocking rust-lang#92243. This PR adds a `mod expr;` and `mod item;` to move logic related to those AST nodes out of the single huge file.
Collaborator
|
☔ The latest upstream changes (presumably #93069) made this pull request unmergeable. Please resolve the merge conflicts. |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
I found that the pervasive use of random anonymous bools in the pretty printer made code changes hard to review. Like in the following, it's easy for a reviewer to be inclined to just assume that
falseandtrueare correct without tracking down the signature to find out what they mean.rust/compiler/rustc_ast_pretty/src/pprust/state.rs
Lines 460 to 468 in d6d12b6
This PR replaces all the
boolin function signatures in the pretty printer with appropriately named newtype wrappers aroundbool.Illustrative example from the code that deals with printing
&T/&mut T/&raw const T/&raw mut T:Before
rust/compiler/rustc_ast_pretty/src/pprust/state.rs
Lines 1915 to 1922 in d6d12b6
After
https://github.com/rust-lang/rust/blob/fa65008f2fa822c100c10d73ba220f4e4e5352f3/compiler/rustc_ast_pretty/src/pprust/state.rs#L2005-L2012