Skip to content

Pretty-print MIR user types too.#158982

Merged
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
cjgillot:pretty-ascribe-user-ty
Jul 13, 2026
Merged

Pretty-print MIR user types too.#158982
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
cjgillot:pretty-ascribe-user-ty

Conversation

@cjgillot

@cjgillot cjgillot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

ty::UserType is currently dumped in MIR using debug-printing of types. Unfortunately, this shows the inner index of DefIds, which can change between compilations depending on cfg flags.

This PR proposes to wire ty::UserType into the normal pretty-printing infra, which will give more readable outputs. This also adds a test, as we did not have any mir-opt case featuring non-None user_self_ty.

Exact formatting to bikeshed.

@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 Jul 8, 2026
@rustbot

rustbot commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

r? @davidtwco

rustbot has assigned @davidtwco.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler
  • compiler expanded to 75 candidates
  • Random selection from 18 candidates

@cjgillot cjgillot changed the title Pretty-print user self types too. Pretty-print MIR user types too. Jul 8, 2026
@davidtwco

Copy link
Copy Markdown
Member

@bors r+ rollup

@rust-bors

rust-bors Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 60aa191 has been approved by davidtwco

It is now in the queue for this repository.

@rust-bors rust-bors Bot 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 Jul 13, 2026
jhpratt added a commit to jhpratt/rust that referenced this pull request Jul 13, 2026
…=davidtwco

Pretty-print MIR user types too.

`ty::UserType` is currently dumped in MIR using debug-printing of types. Unfortunately, this shows the inner index of DefIds, which can change between compilations depending on `cfg` flags.

This PR proposes to wire `ty::UserType` into the normal pretty-printing infra, which will give more readable outputs. This also adds a test, as we did not have any mir-opt case featuring non-None `user_self_ty`.

Exact formatting to bikeshed.
rust-bors Bot pushed a commit that referenced this pull request Jul 13, 2026
Rollup of 11 pull requests

Successful merges:

 - #159210 (`rust-analyzer` subtree update)
 - #158655 (Fix coroutine MIR saved local remapping)
 - #159205 (bootstrap: Replace `ShouldRun::crates` with `crate_or_deps_filtered`)
 - #159208 (Fix `attr_on_non_tail_expr` typo)
 - #157524 (Fix relative paths in private import suggestions)
 - #158325 (Document NonNull layout guarantees)
 - #158882 (enable `do_not_recommend` attr for method call errors in current solver)
 - #158982 (Pretty-print MIR user types too.)
 - #159069 (Add codegen test for constant returns after local use)
 - #159163 (rustc_target: Add acquire-release to implied features of v8)
 - #159201 (borrowck: Represent 'best blame constraint' as index into `Vec<OutlivesConstraint>`)
rust-bors Bot pushed a commit that referenced this pull request Jul 13, 2026
Rollup of 11 pull requests

Successful merges:

 - #159210 (`rust-analyzer` subtree update)
 - #158655 (Fix coroutine MIR saved local remapping)
 - #159205 (bootstrap: Replace `ShouldRun::crates` with `crate_or_deps_filtered`)
 - #159208 (Fix `attr_on_non_tail_expr` typo)
 - #157524 (Fix relative paths in private import suggestions)
 - #158325 (Document NonNull layout guarantees)
 - #158882 (enable `do_not_recommend` attr for method call errors in current solver)
 - #158982 (Pretty-print MIR user types too.)
 - #159069 (Add codegen test for constant returns after local use)
 - #159163 (rustc_target: Add acquire-release to implied features of v8)
 - #159201 (borrowck: Represent 'best blame constraint' as index into `Vec<OutlivesConstraint>`)
@rust-bors rust-bors Bot merged commit d498abe into rust-lang:main Jul 13, 2026
13 checks passed
@rustbot rustbot added this to the 1.99.0 milestone Jul 13, 2026
rust-timer added a commit that referenced this pull request Jul 13, 2026
Rollup merge of #158982 - cjgillot:pretty-ascribe-user-ty, r=davidtwco

Pretty-print MIR user types too.

`ty::UserType` is currently dumped in MIR using debug-printing of types. Unfortunately, this shows the inner index of DefIds, which can change between compilations depending on `cfg` flags.

This PR proposes to wire `ty::UserType` into the normal pretty-printing infra, which will give more readable outputs. This also adds a test, as we did not have any mir-opt case featuring non-None `user_self_ty`.

Exact formatting to bikeshed.
@cjgillot cjgillot deleted the pretty-ascribe-user-ty branch July 13, 2026 17:13
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.

3 participants