aboutsummaryrefslogtreecommitdiff
path: root/crates/hir
diff options
context:
space:
mode:
authorFlorian Diebold <[email protected]>2021-03-21 16:40:14 +0000
committerFlorian Diebold <[email protected]>2021-03-21 17:01:14 +0000
commit1d5c4a77fb33cab7bf8f9d2edc6dd26b09ef65f3 (patch)
tree9cc37c708ec3c2df8adbc1e96204c7a7e2e3ca65 /crates/hir
parent590c41635952e19c3caae525a827499dbd360049 (diff)
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.
Diffstat (limited to 'crates/hir')
-rw-r--r--crates/hir/src/display.rs6
-rw-r--r--crates/hir/src/lib.rs2
2 files changed, 2 insertions, 6 deletions
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 {
236 write!(f, "{}", self.name(f.db))?; 236 write!(f, "{}", self.name(f.db))?;
237 let bounds = f.db.generic_predicates_for_param(self.id); 237 let bounds = f.db.generic_predicates_for_param(self.id);
238 let substs = Substitution::type_params(f.db, self.id.parent); 238 let substs = Substitution::type_params(f.db, self.id.parent);
239 let predicates = bounds 239 let predicates = bounds.iter().cloned().map(|b| b.subst(&substs)).collect::<Vec<_>>();
240 .iter()
241 .cloned()
242 .map(|b| hir_ty::Binders::new(0, b.subst(&substs)))
243 .collect::<Vec<_>>();
244 if !(predicates.is_empty() || f.omit_verbose_types()) { 240 if !(predicates.is_empty() || f.omit_verbose_types()) {
245 write_bounds_like_dyn_trait_with_prefix(":", &predicates, f)?; 241 write_bounds_like_dyn_trait_with_prefix(":", &predicates, f)?;
246 } 242 }
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 {
1460 pub fn trait_bounds(self, db: &dyn HirDatabase) -> Vec<Trait> { 1460 pub fn trait_bounds(self, db: &dyn HirDatabase) -> Vec<Trait> {
1461 db.generic_predicates_for_param(self.id) 1461 db.generic_predicates_for_param(self.id)
1462 .into_iter() 1462 .into_iter()
1463 .filter_map(|pred| match &pred.value { 1463 .filter_map(|pred| match &pred.skip_binders().skip_binders() {
1464 hir_ty::WhereClause::Implemented(trait_ref) => { 1464 hir_ty::WhereClause::Implemented(trait_ref) => {
1465 Some(Trait::from(trait_ref.hir_trait_id())) 1465 Some(Trait::from(trait_ref.hir_trait_id()))
1466 } 1466 }