diff options
| author | Dawer <7803845+iDawer@users.noreply.github.com> | 2021-09-29 00:26:58 +0500 |
|---|---|---|
| committer | Dawer <7803845+iDawer@users.noreply.github.com> | 2021-09-29 00:26:58 +0500 |
| commit | f222665ebe81cfcd8699c1bb5da3c936b6b2d2f9 (patch) | |
| tree | 645000c65b769900f537c03be75192c74ec9266d | |
| parent | 11aed78e2b0aa573f152a2159ae3525b01c9581d (diff) | |
| download | rust-f222665ebe81cfcd8699c1bb5da3c936b6b2d2f9.tar.gz rust-f222665ebe81cfcd8699c1bb5da3c936b6b2d2f9.zip | |
fix: replace errors in a type when doing autoderef
| -rw-r--r-- | crates/hir/src/lib.rs | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs index a28e93d53b0..5b3bea2307e 100644 --- a/crates/hir/src/lib.rs +++ b/crates/hir/src/lib.rs @@ -2504,9 +2504,8 @@ impl Type { pub fn autoderef<'a>(&'a self, db: &'a dyn HirDatabase) -> impl Iterator<Item = Type> + 'a { // There should be no inference vars in types passed here - // FIXME check that? - let canonical = - Canonical { value: self.ty.clone(), binders: CanonicalVarKinds::empty(&Interner) }; + let ty = hir_ty::replace_errors_with_variables(&self.ty).value; + let canonical = Canonical { value: ty, binders: CanonicalVarKinds::empty(&Interner) }; let environment = self.env.env.clone(); let ty = InEnvironment { goal: canonical, environment }; autoderef(db, Some(self.krate), ty) @@ -2600,7 +2599,6 @@ impl Type { callback: &mut dyn FnMut(&Ty, AssocItemId) -> ControlFlow<()>, ) { // There should be no inference vars in types passed here - // FIXME check that? let canonical = hir_ty::replace_errors_with_variables(&self.ty); let env = self.env.clone(); |
