Skip to content

Improve hir pretty printing - #140606

Merged
bors merged 7 commits into
rust-lang:masterfrom
nnethercote:hir-pp
May 3, 2025
Merged

Improve hir pretty printing#140606
bors merged 7 commits into
rust-lang:masterfrom
nnethercote:hir-pp

Conversation

@nnethercote

Copy link
Copy Markdown
Contributor

It's currently pretty bad, so a few small improvements can make a big difference.

r? @dtolnay

They don't appear to do anything -- no test output is affected -- and no
other pretty-printing code looks like this.
As far as I can tell, this code is not actually reachable.
One of the boxes isn't closed, and this causes everything after it to be
over-indented.
All the box open/close issues have been fixed.
@rustbotrustbot added A-rustdoc-json Area: Rustdoc JSON backend S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels May 3, 2025
@rustbot

Copy link
Copy Markdown
Collaborator

Some changes occurred in tests/rustdoc-json

cc @aDotInTheVoid

@dtolnaydtolnay left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looking good!

@dtolnay

Copy link
Copy Markdown
Member

@bors r+

@bors

bors commented May 3, 2025

Copy link
Copy Markdown
Collaborator

📌 Commit 9af0842 has been approved by dtolnay

It is now in the queue for this repository.

@borsbors 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 May 3, 2025
bors added a commit to rust-lang-ci/rust that referenced this pull request May 3, 2025
…iaskrgr
Rollup of 8 pull requests
Successful merges:
- rust-lang#139343 (Change signature of File::try_lock and File::try_lock_shared)
- rust-lang#140505 (linker: Quote symbol names in .def files)
- rust-lang#140534 (PassWrapper: adapt for llvm/llvm-project@f137c3d592e96330e450a8fd63ef…)
- rust-lang#140546 (Remove backtrace dep from anyhow in features status dump tool)
- rust-lang#140548 (Emit user type annotations for free consts in pattern position)
- rust-lang#140564 (Use present indicative tense in std::io::pipe() API docs)
- rust-lang#140568 (Add regression test for rust-lang#140545)
- rust-lang#140606 (Improve hir pretty printing)
r? `@ghost`
`@rustbot` modify labels: rollup
@bors
bors merged commit 185f9e0 into rust-lang:masterMay 3, 2025
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request May 3, 2025
Rollup merge of rust-lang#140606 - nnethercote:hir-pp, r=dtolnay
Improve hir pretty printing
It's currently pretty bad, so a few small improvements can make a big difference.
r? `@dtolnay`
@rustbotrustbot added this to the 1.88.0 milestone May 3, 2025
@nnethercote
nnethercote deleted the hir-pp branch May 4, 2025 22:39
@jyn514

Copy link
Copy Markdown
Member

hey @nnethercote, please don't just --bless away changes to rustdoc-json - this broke cargo semver-checks

@jyn514

Copy link
Copy Markdown
Member

cc #137645

@nnethercote

Copy link
Copy Markdown
ContributorAuthor

Sorry for the breakage. Why are there no cargo semver-checks to catch this?

@jyn514

Copy link
Copy Markdown
Member

it's OK. @aDotInTheVoid is going to change the ping message to make it more clear this is a public API.

@obi1kenobi

obi1kenobi commented May 6, 2025

Copy link
Copy Markdown
Member

Sorry for the breakage. Why are there no cargo semver-checks to catch this?

It was caught by the test suites of cargo-semver-checks and its components. Their test suites are fairly extensive (a decent bit larger than the rustdoc JSON tests) and at one point there was discussion about running them in rustdoc's own CI to catch rustdoc JSON bugs (#110815). At the time that seemed like a lot of work for not much gain, but perhaps it's an idea to revisit.

I opened #140689 to track recovering the original behavior, unless we decide to roll forward instead and just bump the format version number. That would be a bit inconvenient, but I can deal with it if it's preferable.

Zalathar added a commit to Zalathar/rust that referenced this pull request May 8, 2025
…dtolnay
triagebot: Better message for changes to `tests/rustdoc-json`
Followup to rust-lang#140689 / rust-lang#140606
Adds a message to changes to `tests/rustdoc-json`, instead of just pinging me. Hopefully this makes the significance of these tests clearer to people who otherwise wouldn't have context, so hopefully we can avoid that happening again. It's annoyingly hard to know how well this works, because the real test is seeing if it doesn't get ignored.
Predrag has [kindly offered](rust-lang#140689 (comment)) to also get pinged here.
cc `@jyn514` `@obi1kenobi`
r? `@GuillaumeGomez`
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request May 8, 2025
…dtolnay
triagebot: Better message for changes to `tests/rustdoc-json`
Followup to rust-lang#140689 / rust-lang#140606
Adds a message to changes to `tests/rustdoc-json`, instead of just pinging me. Hopefully this makes the significance of these tests clearer to people who otherwise wouldn't have context, so hopefully we can avoid that happening again. It's annoyingly hard to know how well this works, because the real test is seeing if it doesn't get ignored.
Predrag has [kindly offered](rust-lang#140689 (comment)) to also get pinged here.
cc ``@jyn514`` ``@obi1kenobi``
r? ``@GuillaumeGomez``
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request May 8, 2025
Rollup merge of rust-lang#140773 - aDotInTheVoid:rdj-triagdfsadgs, r=dtolnay
triagebot: Better message for changes to `tests/rustdoc-json`
Followup to rust-lang#140689 / rust-lang#140606
Adds a message to changes to `tests/rustdoc-json`, instead of just pinging me. Hopefully this makes the significance of these tests clearer to people who otherwise wouldn't have context, so hopefully we can avoid that happening again. It's annoyingly hard to know how well this works, because the real test is seeing if it doesn't get ignored.
Predrag has [kindly offered](rust-lang#140689 (comment)) to also get pinged here.
cc ``@jyn514`` ``@obi1kenobi``
r? ``@GuillaumeGomez``
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-rustdoc-jsonArea: Rustdoc JSON backendS-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

@nnethercote@rustbot@dtolnay@bors@jyn514@obi1kenobi