fix: Remove some deep normalizations from infer #20980
Open
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.
Fixes #20975
The issue comes from this assertion:
rust-analyzer/crates/hir-ty/src/next_solver/normalize.rs
Line 48 in 4bf516e
The deeply normalization goals returns ambiguous errors with type unspecified integer literal because each integer types are all valid candidates.
Normaly, they should be fallbacked into
i32but that's done manually in the type inference, not from the trait solving.This PR removes deep normalizations on
Tybut there are still two places calling it withT: TypeFoldablewith nonTy.I tried to remove the deep normalization entirely from infer, this function.
rust-analyzer/crates/hir-ty/src/infer/unify.rs
Lines 288 to 299 in 4bf516e
But it caused few regressions especially upon const generic parameters so I left them for now. (Our const evaluation are quite wrong so might need be fixed from there)
I think this is not overlaps with #20974 but this can be waited and rebased upon it if so 😄