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::Adt's Debug impl be more pretty #115873

Merged
merged 1 commit into from
Sep 19, 2023

Conversation

BoxyUwU
Copy link
Member

@BoxyUwU BoxyUwU commented Sep 15, 2023

Currently {:?} on Ty for a TyKind::Adt would print as Adt(Foo, []). This PR changes it to be Foo when there are no generics or Foo<T>/Foo<T, U> when there are generics. Example from debug log:
├─0ms DEBUG rustc_hir_analysis::astconv return=Bar<T/#0, U/#1>

I should have done this in my initial PR for a prettier TyKind: Debug impl but I thought I would need to be accessing generics_of to figure out where in the "path" the generics would have to go??? but no, adts literally only have a single place the generics can go (on the end). Feel a bit silly about this :)

r? @oli-obk

@rustbot rustbot added 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. labels Sep 15, 2023
@BoxyUwU
Copy link
Member Author

BoxyUwU commented Sep 15, 2023

cc #115661 @RalfJung

@rust-log-analyzer

This comment has been minimized.

@oli-obk
Copy link
Contributor

oli-obk commented Sep 15, 2023

r=me with mir opts blessed

@bors rollup

@BoxyUwU
Copy link
Member Author

BoxyUwU commented Sep 15, 2023

@bors r=oil-ok

@bors
Copy link
Contributor

bors commented Sep 15, 2023

📌 Commit 7a7b4f3 has been approved by oil-ok

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 Sep 15, 2023
@oli-obk
Copy link
Contributor

oli-obk commented Sep 15, 2023

@bors r-
@bors r+

@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 Sep 15, 2023
@bors
Copy link
Contributor

bors commented Sep 15, 2023

📌 Commit 7a7b4f3 has been approved by oli-obk

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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Sep 15, 2023
bors added a commit to rust-lang-ci/rust that referenced this pull request Sep 16, 2023
…iaskrgr

Rollup of 2 pull requests

Successful merges:

 - rust-lang#115607 (clarify that unsafe code must not rely on our safe traits)
 - rust-lang#115866 (make interpreter and TyAndLayout type Debug impl independent of Ty debug impl)

Failed merges:

 - rust-lang#115873 (Make `TyKind::Adt`'s `Debug` impl be more pretty)
 - rust-lang#115884 (make ty::Const debug printing less verbose)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors
Copy link
Contributor

bors commented Sep 16, 2023

☔ The latest upstream changes (presumably #115889) made this pull request unmergeable. Please resolve the merge conflicts.

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

Rollup of 3 pull requests

Successful merges:

 - rust-lang#115860 (Enable varargs support for AAPCS calling convention)
 - rust-lang#115867 (coverage: Simplify internal representation of debug types)
 - rust-lang#115885 (don't globally ignore rustc-ice files)

Failed merges:

 - rust-lang#115873 (Make `TyKind::Adt`'s `Debug` impl be more pretty)
 - rust-lang#115884 (make ty::Const debug printing less verbose)

r? `@ghost`
`@rustbot` modify labels: rollup
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Sep 16, 2023
make ty::Const debug printing less verbose

Similar in spirit to rust-lang#115873
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Sep 16, 2023
Rollup merge of rust-lang#115884 - RalfJung:const-debug-print, r=oli-obk

make ty::Const debug printing less verbose

Similar in spirit to rust-lang#115873
@BoxyUwU
Copy link
Member Author

BoxyUwU commented Sep 18, 2023

@bors r=oli-obk

@bors
Copy link
Contributor

bors commented Sep 18, 2023

📌 Commit b2bf4b6 has been approved by oli-obk

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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Sep 18, 2023
bors added a commit to rust-lang-ci/rust that referenced this pull request Sep 19, 2023
…iaskrgr

Rollup of 8 pull requests

Successful merges:

 - rust-lang#115869 (Avoid blessing cargo deps's source code in ui tests)
 - rust-lang#115873 (Make `TyKind::Adt`'s `Debug` impl be more pretty)
 - rust-lang#115879 (Migrate diagnostics in `hir_typeck/src/cast.rs`)
 - rust-lang#115930 (coverage: Fix an unstable-sort inconsistency in coverage spans)
 - rust-lang#115931 (Move mobile topbar title creation entirely into JS)
 - rust-lang#115941 (Add myself to .mailmap)
 - rust-lang#115943 (compiletest: Don't swallow some error messages.)
 - rust-lang#115949 (Update browser-ui-test version)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 48c6051 into rust-lang:master Sep 19, 2023
11 checks passed
@rustbot rustbot added this to the 1.74.0 milestone Sep 19, 2023
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Sep 19, 2023
Rollup merge of rust-lang#115873 - BoxyUwU:tykind_adt_debug, r=oli-obk

Make `TyKind::Adt`'s `Debug` impl be more pretty

Currently `{:?}` on `Ty` for a `TyKind::Adt` would print as `Adt(Foo, [])`. This PR changes it to be `Foo` when there are no generics or `Foo<T>`/`Foo<T, U>` when there _are_ generics. Example from debug log:
`├─0ms DEBUG rustc_hir_analysis::astconv return=Bar<T/#0, U/#1>`

I should have done this in my initial PR for a prettier TyKind: Debug impl but I thought I would need to be accessing generics_of to figure out where in the "path" the generics would have to go??? but no, adts literally only have a single place the generics can go (on the end). Feel a bit silly about this :)

r? `@oli-obk`
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.

5 participants