rust-lang / rust-lang/rust

Unify/streamline long type name written to disk mechanism

Open
#129,297 1 comment 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-diagnostics C-cleanup D-diagnostic-infra T-compiler
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

I've unified (I think) the long type output file in note_obligation_cause_code, and moved the filename note to the end of note_obligation_cause_code. The long type output file probably should be passed even further up the call chain. Although further up in the call chain, there are also various instances of scattered output file / filename notes (esp. in rustc_hir_typeck) which probably should eventually be somehow unified too (probably not in this PR).

Originally posted by @jieyouxu in https://github.com/rust-lang/rust/issues/121739#issuecomment-1969819008


In rustc_hir_typeck and probably in more places, there are random scattered logic for writing long type names to disk. Last I tried to modify them in #121739, I discovered that:

  • Where and how these long type name files are created is inconsistent.
  • There are probably multiple places where different files are created, which can cause multiple long type name files to emitted if you aren't careful.
  • AFAICT, they might not properly respect --remap-path-prefix and such.
  • Not sure if this is problematic for reproducibility, probably not.

It's probably better if we tried to unify the long type name written to disk so they are treated consistently and to avoid the duplicate type name file output footguns. This could potentially aid in addressing #129296.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Read the long-type output handling in note_obligation_cause_code and the scattered logic in rustc_hir_typeck, then trace how the filename and output file move up the call chain. Done means long type names are written through one consistent mechanism, without duplicate files, while respecting path remapping; consider how this relates to #129296.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.