-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Give types to some bool function arguments in pretty printer #92243
Conversation
r? @estebank (rust-highfive has picked a reviewer for you, use r? to override) |
This comment has been minimized.
This comment has been minimized.
☔ The latest upstream changes (presumably #92397) made this pull request unmergeable. Please resolve the merge conflicts. |
|
☔ The latest upstream changes (presumably #92664) made this pull request unmergeable. Please resolve the merge conflicts. |
|
The job Click to see the possible cause of the failure (guessed by this bot)
|
Blocked by compiler/rustc_ast_pretty/src/pprust/state.rs being over the 3000 lines |
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.
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.
☔ The latest upstream changes (presumably #93069) made this pull request unmergeable. Please resolve the merge conflicts. |
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
false
andtrue
are 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
bool
in 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