Skip to content

Decouple rustc_hir::print into rustc_hir_pretty #70344

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 7 commits into from
Mar 27, 2020

Conversation

Centril
Copy link
Contributor

@Centril Centril commented Mar 24, 2020

High level summary:

  • The HIR pretty printer, rustc_hir::print is moved into a new crate rustc_hir_pretty.
  • rustc_ast_pretty and rustc_errors are dropped as rustc_hir dependencies.
  • The dependence on HIR pretty is generally reduced, leaving rustc_save_analysis, rustdoc, rustc_metadata, and rustc_driver as the remaining clients.

The main goal here is to reduce rustc_hir's dependencies and its size such that it can start and finish earlier, thereby working towards #65031.

r? @Zoxc

@bors

This comment has been minimized.

@bors bors added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Mar 24, 2020
@Centril

This comment has been minimized.

@Centril Centril added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Mar 24, 2020
@Zoxc
Copy link
Contributor

Zoxc commented Mar 25, 2020

The printing stuff isn't quite my wheelhouse.

r? @eddyb

@rust-highfive rust-highfive assigned eddyb and unassigned Zoxc Mar 25, 2020
@@ -696,10 +696,13 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
self,
&cause,
&mut |db| {
db.span_label(
fn_decl.output.span(),
format!("expected `{}` because of this return type", fn_decl.output,),
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if this was always meant to print a Ty but accidentally printed HIR.

return self.get_fn_decl(hir_id).map(|(fn_decl, _)| {
(
fn_decl.output.span(),
format!("expected `{}` because of this return type", fn_decl.output),
Copy link
Member

Choose a reason for hiding this comment

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

This also looks like it might be meant to be a Ty not HIR.

@@ -170,6 +170,24 @@ fn object_safety_violations_for_trait(
violations
}

fn trait_bound_spans<'tcx>(
Copy link
Member

Choose a reason for hiding this comment

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

sized_trait_bound_spans, maybe?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yea I wasn't really satisfied with the current name, yours is better.

@eddyb
Copy link
Member

eddyb commented Mar 26, 2020

r=me after addressing #70344 (comment), the hir::FnRetTy -> Ty stuff is probably too messy.

@Centril
Copy link
Contributor Author

Centril commented Mar 26, 2020

@bors r=eddyb

@bors
Copy link
Collaborator

bors commented Mar 26, 2020

📌 Commit b514c42 has been approved by eddyb

@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 Mar 26, 2020
@bors
Copy link
Collaborator

bors commented Mar 26, 2020

⌛ Testing commit b514c42 with merge dbc53eff3922c88a47237fef10fe21d9e39e61a5...

Centril added a commit to Centril/rust that referenced this pull request Mar 26, 2020
Decouple `rustc_hir::print` into `rustc_hir_pretty`

High level summary:
- The HIR pretty printer, `rustc_hir::print` is moved into a new crate `rustc_hir_pretty`.
- `rustc_ast_pretty` and `rustc_errors` are dropped as `rustc_hir` dependencies.
- The dependence on HIR pretty is generally reduced, leaving `rustc_save_analysis`, `rustdoc`, `rustc_metadata`, and `rustc_driver` as the remaining clients.

The main goal here is to reduce `rustc_hir`'s dependencies and its size such that it can start and finish earlier, thereby working towards rust-lang#65031.

r? @Zoxc
@Centril
Copy link
Contributor Author

Centril commented Mar 26, 2020

@bors retry

@Centril
Copy link
Contributor Author

Centril commented Mar 26, 2020

Failed in #70425 (comment), @bors r-
(Note to self: add #![recursion_limit="256"] to rustc_hir_pretty.)

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Mar 26, 2020
@Centril
Copy link
Contributor Author

Centril commented Mar 26, 2020

@bors r=eddyb

@bors
Copy link
Collaborator

bors commented Mar 26, 2020

📌 Commit b2f7a95 has been approved by eddyb

@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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Mar 26, 2020
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 27, 2020
Rollup of 5 pull requests

Successful merges:

 - rust-lang#69644 (Remove framework in `dataflow/mod.rs` in favor of "generic" one)
 - rust-lang#69936 (Fix cycle error when emitting suggestion for mismatched `fn` type)
 - rust-lang#70048 (Allow obtaining &mut OsStr)
 - rust-lang#70344 (Decouple `rustc_hir::print` into `rustc_hir_pretty`)
 - rust-lang#70435 (Add regression test for rust-lang#66706)

Failed merges:

r? @ghost
@bors bors merged commit 7041efc into rust-lang:master Mar 27, 2020
@Centril Centril deleted the hir-pretty branch March 27, 2020 03:57
matthiaskrgr added a commit to matthiaskrgr/rust-clippy that referenced this pull request Mar 27, 2020
matthiaskrgr added a commit to matthiaskrgr/rust-clippy that referenced this pull request Mar 27, 2020
matthiaskrgr added a commit to matthiaskrgr/rust-clippy that referenced this pull request Mar 27, 2020
matthiaskrgr added a commit to matthiaskrgr/rust-clippy that referenced this pull request Mar 27, 2020
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Mar 27, 2020
Changes:
````
remove redundant import
rustup rust-lang#68404
rustup rust-lang#69644
rustup rust-lang#70344
Move verbose_file_reads to restriction
move redundant_pub_crate to nursery
readme: explain how to run only a single lint on a codebase
Remove dependency on `matches` crate
Move useless_transmute to nursery
nursery group -> style
Update for PR feedback
Auto merge of rust-lang#5314 - ehuss:remove-git2, r=flip1995
Lint for `pub(crate)` items that are not crate visible due to the visibility of the module that contains them
````

Fixes rust-lang#70456
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 28, 2020
submodules: update clippy from 1ff81c1 to 70b93aa

Changes:
````
remove redundant import
rustup rust-lang#68404
rustup rust-lang#69644
rustup rust-lang#70344
Move verbose_file_reads to restriction
move redundant_pub_crate to nursery
readme: explain how to run only a single lint on a codebase
Remove dependency on `matches` crate
Move useless_transmute to nursery
nursery group -> style
Update for PR feedback
Auto merge of rust-lang#5314 - ehuss:remove-git2, r=flip1995
Lint for `pub(crate)` items that are not crate visible due to the visibility of the module that contains them
````

Fixes rust-lang#70456
floriangru added a commit to hacspec/rust-clippy that referenced this pull request Apr 1, 2020
flip1995 pushed a commit to flip1995/rust-clippy that referenced this pull request May 5, 2020
Changes:
````
remove redundant import
rustup rust-lang/rust#68404
rustup rust-lang/rust#69644
rustup rust-lang/rust#70344
Move verbose_file_reads to restriction
move redundant_pub_crate to nursery
readme: explain how to run only a single lint on a codebase
Remove dependency on `matches` crate
Move useless_transmute to nursery
nursery group -> style
Update for PR feedback
Auto merge of rust-lang#5314 - ehuss:remove-git2, r=flip1995
Lint for `pub(crate)` items that are not crate visible due to the visibility of the module that contains them
````

Fixes #70456
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants