internal: Do not relower the signature again in inference, instead fetch it from other queries - #23190
Merged
Merged
Conversation
Member
TBH, we should liberate the late bound regions when doing inference. We could potentially remove this field as well: https://github.com/ChayimFriedman2/rust-analyzer/blob/08383ae310109cda25123fe77fd4521772b746b9/crates/hir-ty/src/lower.rs#L232 |
Contributor
Author
|
We still use |
This comment has been minimized.
This comment has been minimized.
The new code is more consistent, easier to maintain and not forget to cover all cases when we add new things (e.g. new queries creating anon consts), and fixes a few missing edges (see the changed diagnostics in incorrect_case that now emit a diagnostic they haven't previously).
…m other queries Not only this helps perf, this also make it possible to define `AnonConst` as a tracked struct (but this PR doesn't do that yet), because it won't be created twice. There's a slight regression in tests because I followed rustc and liberated late bounds regions in the signature, and the printing of bound regions is suboptimal. I didn't fix this to not interfere with @dfireBird's work.
ChayimFriedman2
force-pushed
the
no-relowering
branch
from
September 3, 2026 06:06
08383ae to
e7fd880
Compare
Collaborator
|
This PR was rebased onto a different master 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. |
Veykril
approved these changes
Sep 3, 2026
This was referenced Sep 3, 2026
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.
Not only this helps perf, this also make it possible to define
AnonConstas a tracked struct (but this PR doesn't do that yet), because it won't be created twice.There's a slight regression in tests because I followed rustc and liberated late bounds regions in the signature, and the printing of bound regions is suboptimal. I didn't fix this to not interfere with @dfireBird's work.
For that to work I had to first push the first commit that refactors collection of diagnostics in
hir. The commit are almost fully separate and can be reviewed separately.