Skip to content

Rename typing modes to better describe real usage#157667

Open
jdonszelmann wants to merge 2 commits into
rust-lang:mainfrom
jdonszelmann:rename-typingmode-again
Open

Rename typing modes to better describe real usage#157667
jdonszelmann wants to merge 2 commits into
rust-lang:mainfrom
jdonszelmann:rename-typingmode-again

Conversation

@jdonszelmann

@jdonszelmann jdonszelmann commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

r? @lcnr

cc: @BoxyUwU

Lcnr and I brainstormed these names before RustWeek, but I never got to actually changing it. As for rationale:

  • Coherence: stays the same
  • Analysis: given that basically all of type checking is analyzing code, this didn't feel so accurate. It's now called Typeck to signify that it's mainly used during hir_typeck.
  • Borrowck: this is the one that actually started the discussion about renaming. Borrowck is used in quite a few places now that are not Borrowck, simply to avoid making inference progress on opaque types. It's renamed to PostTypeck, since its used after Typeck.
  • PostBorrowckAnalysis is now simply called PostBorrowck, since it's supposed to be used after borrowck finishes.
  • PostAnalysis stays the same, it's the typing mode used after all type analysis finished
  • There's now also a new Codegen typing mode. It's unchanged too.

To preempt some questions, I mainly did this rename through normal editor renames. I then also did a search with various regexes over ever occurence of //.*Analysis and //.*Borrowck and PostBorrowck, and some more similar regexes to make sure as many comments as possible are updated, if not all.

Notably, this PR does not update RustAnlayzer to use the same names yet.

Warning: this PR may be somewhat conflicty :/

@rustbot

rustbot commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

Some changes occurred to the CTFE machinery

cc @RalfJung, @oli-obk, @lcnr

Some changes occurred to constck

cc @fee1-dead

Some changes occurred to the core trait solver

cc @rust-lang/initiative-trait-system-refactor

@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. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver) labels Jun 9, 2026
@jdonszelmann

Copy link
Copy Markdown
Contributor Author

sorry for the pings :3

@jdonszelmann jdonszelmann changed the title Rename typing modes to be more descriptive of real usage Rename typing modes to better describe of real usage Jun 9, 2026
@jdonszelmann jdonszelmann changed the title Rename typing modes to better describe of real usage Rename typing modes to better describe real usage Jun 9, 2026

@lcnr lcnr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

sgtm 🤔 there are two things I still slightly dislike about the new names

  • TypingMode::Typeck, PostTypeck, PostBorrowck are all the same if there are no opaques or coroutines. We could have a separate general TypingMode::Analysis which is always used if the list of opaques etc etc would be empty. I think TypingMode::borrowck already falls back to Typeck if there are no opaques in the defining scope
  • PostTypeck is more PostTypeckUntilBorrowck. slightly cumbersome as a name, but maybe slightly better.

For completeness, with this PR

enum TypingMode {
    Coherence,
    Typeck,
    PostTypeck, // used by borrowck and anything else that happens pre borrowck but uses typeck results
    PostBorrowck, // opaques are fully inferred now, still don't reveal opaques from other bodies as it is userfacing
    PostAnalysis, // optimizations etc etc
    Codegen, // like `PostAnalysis`, but some query cycle stuff
}

View changes since this review

@jdonszelmann jdonszelmann force-pushed the rename-typingmode-again branch from a590b5f to 6921ae1 Compare June 10, 2026 13:09
@rustbot

rustbot commented Jun 10, 2026

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants