-
Notifications
You must be signed in to change notification settings - Fork 1.9k
fix: Remove some deep normalizations from infer #20980
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| let ty = self.normalize_associated_types_in(ty); | ||
| self.resolve_vars_with_obligations(ty) | ||
| } | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This ugly function was introduced by me (with some visitors back then) to fix some errors on non-resolved nested opaque types during mir lowering but it isn't needed anymore 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some tests are seemingly regressed but I believe they are okay because they are errornous types
|
Well, actually this is mostly done by #20974 😅 I'll just add a test and some minor changes - though this one is minor in overall 😅 - in this PR once it has landed |
|
I'll check whether we still need this |
015bbe3 to
64cba9b
Compare
64cba9b to
d5ea170
Compare
|
Most of this has been resolved by #20974 and this is quite straightforward like adding a regression test and remove my ugly function. So, I'm gonna merge this |
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 😄