Skip to content

internal: Do not relower the signature again in inference, instead fetch it from other queries - #23190

Open
ChayimFriedman2 wants to merge 2 commits into
rust-lang:masterfrom
ChayimFriedman2:no-relowering
Open

internal: Do not relower the signature again in inference, instead fetch it from other queries#23190
ChayimFriedman2 wants to merge 2 commits into
rust-lang:masterfrom
ChayimFriedman2:no-relowering

Conversation

@ChayimFriedman2

Copy link
Copy Markdown
Contributor

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.

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.

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.
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 19, 2026
@dfireBird

Copy link
Copy Markdown
Member

followed rustc and liberated late bounds regions in the signature

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

@ChayimFriedman2

Copy link
Copy Markdown
Contributor Author

We still use LifetimeLoweringMode::LateParam but we probably can not to; that's for later PR though.

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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants