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

Factor convenience functions out of main printer implementation #93515

Merged
merged 1 commit into from
Feb 3, 2022

Conversation

dtolnay
Copy link
Member

@dtolnay dtolnay commented Jan 31, 2022

The pretty printer in rustc_ast_pretty has a section of methods commented "Convenience functions to talk to the printer". This PR pulls those out to a separate module. This leaves pp.rs with only the minimal API that is core to the pretty printing algorithm.

I found this separation to be helpful in https://github.com/dtolnay/prettyplease because it makes clear when changes are adding some fundamental new capability to the pretty printer algorithm vs just making it more convenient to call some already existing functionality.

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Jan 31, 2022
@rust-highfive
Copy link
Collaborator

r? @davidtwco

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 31, 2022
@davidtwco
Copy link
Member

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Feb 3, 2022

📌 Commit 2d7ffbb has been approved by davidtwco

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 3, 2022
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Feb 3, 2022
Factor convenience functions out of main printer implementation

The pretty printer in rustc_ast_pretty has a section of methods commented "Convenience functions to talk to the printer". This PR pulls those out to a separate module. This leaves pp.rs with only the minimal API that is core to the pretty printing algorithm.

I found this separation to be helpful in https://github.com/dtolnay/prettyplease because it makes clear when changes are adding some fundamental new capability to the pretty printer algorithm vs just making it more convenient to call some already existing functionality.
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 3, 2022
Rollup of 7 pull requests

Successful merges:

 - rust-lang#92310 (rustdoc: Fix ICE report)
 - rust-lang#92802 (Deduplicate lines in long const-eval stack trace)
 - rust-lang#93515 (Factor convenience functions out of main printer implementation)
 - rust-lang#93566 (Make rustc use `RUST_BACKTRACE=full` by default)
 - rust-lang#93589 (Use Option::then in two places)
 - rust-lang#93600 (fix: Remove extra newlines from junit output)
 - rust-lang#93606 (Correct incorrect description of preorder traversals)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 761705e into rust-lang:master Feb 3, 2022
@rustbot rustbot added this to the 1.60.0 milestone Feb 3, 2022
@dtolnay dtolnay deleted the convenience branch February 3, 2022 18:41
@dtolnay dtolnay added the A-pretty Area: Pretty printing (including `-Z unpretty`) label Dec 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-pretty Area: Pretty printing (including `-Z unpretty`) S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants