aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_ty/src/infer/unify.rs
diff options
context:
space:
mode:
authorFlorian Diebold <[email protected]>2021-04-07 20:26:37 +0100
committerFlorian Diebold <[email protected]>2021-04-08 13:08:55 +0100
commitcaee3b6c2d9a7dbcf678cc06d0c1832a4bf19be4 (patch)
treedf770a02d0474c985cfb283c4386fb3711bae80f /crates/hir_ty/src/infer/unify.rs
parentb25b147e8604f62a5620a5833112e358ebeeb287 (diff)
Replace some `fold` calls
Diffstat (limited to 'crates/hir_ty/src/infer/unify.rs')
-rw-r--r--crates/hir_ty/src/infer/unify.rs19
1 files changed, 4 insertions, 15 deletions
diff --git a/crates/hir_ty/src/infer/unify.rs b/crates/hir_ty/src/infer/unify.rs
index 3732d8ebd..c3d9e81c3 100644
--- a/crates/hir_ty/src/infer/unify.rs
+++ b/crates/hir_ty/src/infer/unify.rs
@@ -118,21 +118,10 @@ impl<'a, 'b> Canonicalizer<'a, 'b> {
118 118
119impl<T: HasInterner<Interner = Interner>> Canonicalized<T> { 119impl<T: HasInterner<Interner = Interner>> Canonicalized<T> {
120 pub(super) fn decanonicalize_ty(&self, ty: Ty) -> Ty { 120 pub(super) fn decanonicalize_ty(&self, ty: Ty) -> Ty {
121 ty.fold_binders( 121 crate::fold_free_vars(ty, |bound, _binders| {
122 &mut |ty, binders| { 122 let (v, k) = self.free_vars[bound.index];
123 if let TyKind::BoundVar(bound) = ty.kind(&Interner) { 123 TyKind::InferenceVar(v, k).intern(&Interner)
124 if bound.debruijn >= binders { 124 })
125 let (v, k) = self.free_vars[bound.index];
126 TyKind::InferenceVar(v, k).intern(&Interner)
127 } else {
128 ty
129 }
130 } else {
131 ty
132 }
133 },
134 DebruijnIndex::INNERMOST,
135 )
136 } 125 }
137 126
138 pub(super) fn apply_solution( 127 pub(super) fn apply_solution(