From 590c41635952e19c3caae525a827499dbd360049 Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Sun, 21 Mar 2021 13:22:22 +0100 Subject: Introduce QuantifiedWhereClause and DynTy analogous to Chalk This introduces a bunch of new binders in lots of places, which we have to be careful about, but we had to add them at some point. --- crates/hir_ty/src/infer/unify.rs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (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 1fc03c8f4..35b0a2059 100644 --- a/crates/hir_ty/src/infer/unify.rs +++ b/crates/hir_ty/src/infer/unify.rs @@ -310,9 +310,18 @@ impl InferenceTable { (TyKind::Placeholder(p1), TyKind::Placeholder(p2)) if *p1 == *p2 => true, - (TyKind::Dyn(dyn1), TyKind::Dyn(dyn2)) if dyn1.len() == dyn2.len() => { - for (pred1, pred2) in dyn1.iter().zip(dyn2.iter()) { - if !self.unify_preds(pred1, pred2, depth + 1) { + (TyKind::Dyn(dyn1), TyKind::Dyn(dyn2)) + if dyn1.bounds.skip_binders().interned().len() + == dyn2.bounds.skip_binders().interned().len() => + { + for (pred1, pred2) in dyn1 + .bounds + .skip_binders() + .interned() + .iter() + .zip(dyn2.bounds.skip_binders().interned().iter()) + { + if !self.unify_preds(pred1.skip_binders(), pred2.skip_binders(), depth + 1) { return false; } } -- cgit v1.2.3