fix: Fix typed_hole panic - #22858
Open
Veykril wants to merge 1 commit into
Open
Conversation
Veykril
force-pushed
the
lukaswirth/push-lvrknnmvnwtq
branch
from
July 19, 2026 11:14
d8419aa to
dd6ecda
Compare
Contributor
|
How does this relate to #22662? |
Comment on lines
+5480
to
+5483
| self.try_rebase_into(db, rebase_into).unwrap_or_else(|| Type { | ||
| owner: rebase_into.owner, | ||
| ty: self.instantiate_with_errors().ty, | ||
| }) |
Contributor
There was a problem hiding this comment.
This change makes it less flexible (although it doesn't really matter): instantiate_with_errors() returns a NoParams owner, which unifies (not just rebases) with any owner.
| self.owner.must_unify(other.owner); | ||
| let env = self.param_env(db); | ||
| let Some(owner) = self.owner.unify(other.owner) else { | ||
| never!("callers should not mix owners"); |
Contributor
There was a problem hiding this comment.
Probably a good idea to still have must_unify() just for this never!()?
We can also have a macro for the return false but that's probably not a good idea.
| never!("callers should not mix owners"); | ||
| return false; | ||
| }; | ||
| let env = Type { owner, ty: self.ty }.param_env(db); |
Contributor
There was a problem hiding this comment.
Why this change? Given that we return on unification failure (and we must, otherwise we can panic) we can leave this as self.param_env(db).
Member
Author
|
Ah I missed your PR |
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.
Fixes #22659
Also makes the hir type unification API more resilient to mistakes in release builds