From 78f1583bdd0cc3d7adb65be6441db52e75e17060 Mon Sep 17 00:00:00 2001
From: Comonad <comonad@foxmail.com>
Date: Thu, 29 Apr 2021 15:26:41 +0800
Subject: fix: closure unify without check ClosureId

closes #8604
---
 crates/hir_ty/src/infer/unify.rs | 4 ++++
 1 file changed, 4 insertions(+)

(limited to 'crates/hir_ty/src/infer')

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 {
                 | (TyKind::Slice(ty1), TyKind::Slice(ty2)) => self.unify_inner(ty1, ty2, depth + 1),
                 _ => true, /* we checked equals_ctor already */
             }
+        } else if let (TyKind::Closure(.., substs1), TyKind::Closure(.., substs2)) =
+            (ty1.kind(&Interner), ty2.kind(&Interner))
+        {
+            self.unify_substs(substs1, substs2, depth + 1)
         } else {
             self.unify_inner_trivial(&ty1, &ty2, depth)
         }
-- 
cgit v1.2.3