fix: Make sense of the mess that were (are) different kind of generics in the solver#20586
Merged
Merged
Conversation
…the solver To the extent possible. Previously they were confused. Sometimes generic params were treated as `Param` and sometimes as `Placeholder`. A completely redundant (in the new solver) mapping of salsa::Id to ints to intern some info where we could just store it uninterned (not in Chalk though, for some weird reason). Plus fix a cute bug in closure substitution that was caught by the assertions of Chalk but the next solver did not have such assertions. Do we need more assertions?
ChayimFriedman2
commented
Sep 2, 2025
| 0, | ||
| LocalTypeOrConstParamId::from_raw(la_arena::RawIdx::from_u32(0)), | ||
| ¶m, | ||
| )], |
Contributor
Author
There was a problem hiding this comment.
To the reviewer: I know what I did here is an indefensible crime. I sincerely apologize for the heart attack you will probably get by reading this. But the alternative was to wrap everything in Option and unwrap(), not more type safety and a lot more churn. I thought about this alone for about 15 minutes, then with a heavy heart voted for this option.
Member
|
Ah lovely, I ran into issues related to this (stemming from the display impl) when moving some stuff from chalk_ir to rustc_type_ir. So this should help with that. |
ShoyuVanilla
approved these changes
Sep 3, 2025
ShoyuVanilla
left a comment
Member
There was a problem hiding this comment.
I believe this would be our best effort before making rust-analyzer completely free of chalk-ir 👍
Member
|
changelog fixup #20329 |
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.
To the extent possible.
Previously they were confused. Sometimes generic params were treated as
Paramand sometimes asPlaceholder. A completely redundant (in the new solver) mapping of salsa::Id to ints to intern some info where we could just store it uninterned (not in Chalk though, for some weird reason).Plus fix a cute bug in closure substitution that was caught by the assertions of Chalk but the next solver did not have such assertions. Do we need more assertions?
Should hopefully fix all failures in #20578.