diff options
Diffstat (limited to 'crates/hir_ty/src/infer')
-rw-r--r-- | crates/hir_ty/src/infer/unify.rs | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/crates/hir_ty/src/infer/unify.rs b/crates/hir_ty/src/infer/unify.rs index 8370f2e1c..06187df56 100644 --- a/crates/hir_ty/src/infer/unify.rs +++ b/crates/hir_ty/src/infer/unify.rs | |||
@@ -108,19 +108,22 @@ impl<'a, 'b> Canonicalizer<'a, 'b> { | |||
108 | } | 108 | } |
109 | 109 | ||
110 | impl<T> Canonicalized<T> { | 110 | impl<T> Canonicalized<T> { |
111 | pub(super) fn decanonicalize_ty(&self, mut ty: Ty) -> Ty { | 111 | pub(super) fn decanonicalize_ty(&self, ty: Ty) -> Ty { |
112 | ty.walk_mut_binders( | 112 | ty.fold_binders( |
113 | &mut |ty, binders| { | 113 | &mut |ty, binders| { |
114 | if let &mut TyKind::BoundVar(bound) = ty.interned_mut() { | 114 | if let TyKind::BoundVar(bound) = ty.kind(&Interner) { |
115 | if bound.debruijn >= binders { | 115 | if bound.debruijn >= binders { |
116 | let (v, k) = self.free_vars[bound.index]; | 116 | let (v, k) = self.free_vars[bound.index]; |
117 | *ty = TyKind::InferenceVar(v, k).intern(&Interner); | 117 | TyKind::InferenceVar(v, k).intern(&Interner) |
118 | } else { | ||
119 | ty | ||
118 | } | 120 | } |
121 | } else { | ||
122 | ty | ||
119 | } | 123 | } |
120 | }, | 124 | }, |
121 | DebruijnIndex::INNERMOST, | 125 | DebruijnIndex::INNERMOST, |
122 | ); | 126 | ) |
123 | ty | ||
124 | } | 127 | } |
125 | 128 | ||
126 | pub(super) fn apply_solution( | 129 | pub(super) fn apply_solution( |