Rename typing modes to better describe real usage#157667
Open
jdonszelmann wants to merge 2 commits into
Open
Conversation
Collaborator
|
Some changes occurred to MIR optimizations cc @rust-lang/wg-mir-opt Some changes occurred to the CTFE machinery Some changes occurred to constck cc @fee1-dead Some changes occurred to the core trait solver cc @rust-lang/initiative-trait-system-refactor |
Contributor
Author
|
sorry for the pings :3 |
lcnr
reviewed
Jun 10, 2026
Contributor
There was a problem hiding this comment.
sgtm 🤔 there are two things I still slightly dislike about the new names
TypingMode::Typeck, PostTypeck, PostBorrowckare all the same if there are no opaques or coroutines. We could have a separate generalTypingMode::Analysiswhich is always used if the list of opaques etc etc would be empty. I thinkTypingMode::borrowckalready falls back toTypeckif there are no opaques in the defining scopePostTypeckis morePostTypeckUntilBorrowck. 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
}a590b5f to
6921ae1
Compare
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 sameAnalysis: given that basically all of type checking is analyzing code, this didn't feel so accurate. It's now calledTypeckto signify that it's mainly used duringhir_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 toPostTypeck, since its used afterTypeck.PostBorrowckAnalysisis now simply calledPostBorrowck, since it's supposed to be used after borrowck finishes.PostAnalysisstays the same, it's the typing mode used after all type analysis finishedCodegentyping 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
//.*Analysisand//.*BorrowckandPostBorrowck, 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 :/