aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_ty/src/infer/unify.rs
diff options
context:
space:
mode:
authorFlorian Diebold <[email protected]>2021-04-05 17:54:31 +0100
committerFlorian Diebold <[email protected]>2021-04-05 18:21:03 +0100
commite28f0c98ba449c372ffcc450ac756f0adbdf9549 (patch)
tree7a5ee320a6ac5615fb8270e3a9fae3b4bd9c0419 /crates/hir_ty/src/infer/unify.rs
parent30a339e038bfd94d8c91f79287be9b7db4f0cb4e (diff)
Get rid of some walk_mut uses
Diffstat (limited to 'crates/hir_ty/src/infer/unify.rs')
-rw-r--r--crates/hir_ty/src/infer/unify.rs15
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
110impl<T> Canonicalized<T> { 110impl<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(