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

Make TyKind: Debug have less verbose output #111988

Merged
merged 1 commit into from
May 30, 2023

Conversation

BoxyUwU
Copy link
Member

@BoxyUwU BoxyUwU commented May 26, 2023

Current TyKind: Debug impl is basically unusable for debugging, its too verbose even for verbose debugging 🤣 This PR replaces the debug logic for TyKind with a more manual debug impl instead of a hand expanded derived impl. This should help make #107084 more reasonable to land since the output of Ty: Debug will be better.

This isn't a fully completed change to the Debug impl of TyKind as there's still logic from the derive macro for some variants. Some of the variants are also not consisten with the -Zverbose printing of Ty, ideally -Zverbose printing of Ty would also just defer to the debug impl instead of having lots of checks in pretty printing. I plan on fixing this in follow up PRs since it seems tricky to do in this one and its already a large PR 😅

@rustbot rustbot 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. WG-trait-system-refactor The Rustc Trait System Refactor Initiative labels May 26, 2023
@BoxyUwU BoxyUwU force-pushed the make_tykind_debug_good branch 3 times, most recently from a579c84 to bcc4657 Compare May 26, 2023 12:07
@BoxyUwU BoxyUwU marked this pull request as ready for review May 26, 2023 12:43
@rustbot

This comment was marked as off-topic.

@BoxyUwU
Copy link
Member Author

BoxyUwU commented May 26, 2023

r? @compiler-errors

@rust-log-analyzer

This comment has been minimized.

@BoxyUwU BoxyUwU force-pushed the make_tykind_debug_good branch 2 times, most recently from 81d8770 to 2fe943f Compare May 26, 2023 17:23
@rust-log-analyzer

This comment has been minimized.

@BoxyUwU BoxyUwU removed T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. A-rustdoc-json Area: Rustdoc JSON backend WG-trait-system-refactor The Rustc Trait System Refactor Initiative labels May 26, 2023
compiler-errors added a commit to compiler-errors/rust that referenced this pull request May 26, 2023
… r=compiler-errors

Change ty and const error's pretty printing to be in braces

`[const error]` and `[type error]` are slightly confusing since they look like either a slice with an error type for the element ty or a slice with a const argument as the type ???. This PR changes them to display as `{const error}` and `{type error}`  similar to `{integer}`.

This does not update the `Debug` impls for them which is done in rust-lang#111988.

I updated some error logic to avoid printing the substs of trait refs when unable to resolve an assoc item for them, this avoids emitting errors with `{type error}` in them. The substs are not relevant for these errors since we don't take into account the substs when resolving the assoc item.

r? `@compiler-errors`
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request May 26, 2023
… r=compiler-errors

Change ty and const error's pretty printing to be in braces

`[const error]` and `[type error]` are slightly confusing since they look like either a slice with an error type for the element ty or a slice with a const argument as the type ???. This PR changes them to display as `{const error}` and `{type error}`  similar to `{integer}`.

This does not update the `Debug` impls for them which is done in rust-lang#111988.

I updated some error logic to avoid printing the substs of trait refs when unable to resolve an assoc item for them, this avoids emitting errors with `{type error}` in them. The substs are not relevant for these errors since we don't take into account the substs when resolving the assoc item.

r? ``@compiler-errors``
Copy link
Member

@compiler-errors compiler-errors left a comment

Choose a reason for hiding this comment

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

this is fine for now, though notably incomplete until we get <Ty as Debug> to use <TyKind as Debug> i think

@compiler-errors
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented May 29, 2023

📌 Commit 976adf3 has been approved by compiler-errors

It is now in the queue for this repository.

@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 May 29, 2023
bors added a commit to rust-lang-ci/rust that referenced this pull request May 29, 2023
…iaskrgr

Rollup of 6 pull requests

Successful merges:

 - rust-lang#111558 (Move tests)
 - rust-lang#111827 (Add build instructions for cranelift backend as part of Rust repo)
 - rust-lang#111988 (Make `TyKind: Debug` have less verbose output)
 - rust-lang#112022 (Check nested obligations during coercion unify in new solver)
 - rust-lang#112057 (Suggest correct `self_ty`)
 - rust-lang#112063 (Add a test for issue 110457/incremental ICE with closures with the same span)

Failed merges:

 - rust-lang#112068 (Move tests from `ui/discrim` dir)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 9f83e56 into rust-lang:master May 30, 2023
11 checks passed
@rustbot rustbot added this to the 1.72.0 milestone May 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

None yet

6 participants