aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_ty/src/infer/unify.rs
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2021-04-29 08:45:37 +0100
committerGitHub <[email protected]>2021-04-29 08:45:37 +0100
commit80bee14e14f67f02746befff77a8a4bbfd3e5849 (patch)
tree9f211591a2055c4820de7b92f5ad7d1aeb06a607 /crates/hir_ty/src/infer/unify.rs
parentdce0d71b18ed78f55989d2a7462ae1d8df10e14f (diff)
parent78f1583bdd0cc3d7adb65be6441db52e75e17060 (diff)
Merge #8687
8687: fix: closure unify without check ClosureId r=lnicola a=komonad Previously, the unification of closure types is blocked by `Ty.equals_ctor` which compares the ClosureId of the closures. Here is a workaround to allow closures to unify their substitutions. Fixes #8604. Co-authored-by: Comonad <[email protected]>
Diffstat (limited to 'crates/hir_ty/src/infer/unify.rs')
-rw-r--r--crates/hir_ty/src/infer/unify.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/crates/hir_ty/src/infer/unify.rs b/crates/hir_ty/src/infer/unify.rs
index a887e20b0..d8e0b4320 100644
--- a/crates/hir_ty/src/infer/unify.rs
+++ b/crates/hir_ty/src/infer/unify.rs
@@ -332,6 +332,10 @@ impl InferenceTable {
332 | (TyKind::Slice(ty1), TyKind::Slice(ty2)) => self.unify_inner(ty1, ty2, depth + 1), 332 | (TyKind::Slice(ty1), TyKind::Slice(ty2)) => self.unify_inner(ty1, ty2, depth + 1),
333 _ => true, /* we checked equals_ctor already */ 333 _ => true, /* we checked equals_ctor already */
334 } 334 }
335 } else if let (TyKind::Closure(.., substs1), TyKind::Closure(.., substs2)) =
336 (ty1.kind(&Interner), ty2.kind(&Interner))
337 {
338 self.unify_substs(substs1, substs2, depth + 1)
335 } else { 339 } else {
336 self.unify_inner_trivial(&ty1, &ty2, depth) 340 self.unify_inner_trivial(&ty1, &ty2, depth)
337 } 341 }