Skip to content

Commit f222665

Browse files
committed
fix: replace errors in a type when doing autoderef
1 parent 11aed78 commit f222665

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

crates/hir/src/lib.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2504,9 +2504,8 @@ impl Type {
25042504

25052505
pub fn autoderef<'a>(&'a self, db: &'a dyn HirDatabase) -> impl Iterator<Item = Type> + 'a {
25062506
// There should be no inference vars in types passed here
2507-
// FIXME check that?
2508-
let canonical =
2509-
Canonical { value: self.ty.clone(), binders: CanonicalVarKinds::empty(&Interner) };
2507+
let ty = hir_ty::replace_errors_with_variables(&self.ty).value;
2508+
let canonical = Canonical { value: ty, binders: CanonicalVarKinds::empty(&Interner) };
25102509
let environment = self.env.env.clone();
25112510
let ty = InEnvironment { goal: canonical, environment };
25122511
autoderef(db, Some(self.krate), ty)
@@ -2600,7 +2599,6 @@ impl Type {
26002599
callback: &mut dyn FnMut(&Ty, AssocItemId) -> ControlFlow<()>,
26012600
) {
26022601
// There should be no inference vars in types passed here
2603-
// FIXME check that?
26042602
let canonical = hir_ty::replace_errors_with_variables(&self.ty);
26052603

26062604
let env = self.env.clone();

0 commit comments

Comments
 (0)