From 1d5c4a77fb33cab7bf8f9d2edc6dd26b09ef65f3 Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Sun, 21 Mar 2021 17:40:14 +0100 Subject: Use QuantifiedWhereClause in generic_predicates as well Still far too much binder skipping going on; I find it hard to imagine this is all correct, but the tests pass. --- crates/hir/src/display.rs | 6 +----- crates/hir/src/lib.rs | 2 +- 2 files changed, 2 insertions(+), 6 deletions(-) (limited to 'crates/hir') diff --git a/crates/hir/src/display.rs b/crates/hir/src/display.rs index c96ebb50a..9f6d7be48 100644 --- a/crates/hir/src/display.rs +++ b/crates/hir/src/display.rs @@ -236,11 +236,7 @@ impl HirDisplay for TypeParam { write!(f, "{}", self.name(f.db))?; let bounds = f.db.generic_predicates_for_param(self.id); let substs = Substitution::type_params(f.db, self.id.parent); - let predicates = bounds - .iter() - .cloned() - .map(|b| hir_ty::Binders::new(0, b.subst(&substs))) - .collect::>(); + let predicates = bounds.iter().cloned().map(|b| b.subst(&substs)).collect::>(); if !(predicates.is_empty() || f.omit_verbose_types()) { write_bounds_like_dyn_trait_with_prefix(":", &predicates, f)?; } diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs index 1844942a6..a325b6691 100644 --- a/crates/hir/src/lib.rs +++ b/crates/hir/src/lib.rs @@ -1460,7 +1460,7 @@ impl TypeParam { pub fn trait_bounds(self, db: &dyn HirDatabase) -> Vec { db.generic_predicates_for_param(self.id) .into_iter() - .filter_map(|pred| match &pred.value { + .filter_map(|pred| match &pred.skip_binders().skip_binders() { hir_ty::WhereClause::Implemented(trait_ref) => { Some(Trait::from(trait_ref.hir_trait_id())) } -- cgit v1.2.3