aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_ty/src/display.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/hir_ty/src/display.rs')
-rw-r--r--crates/hir_ty/src/display.rs33
1 files changed, 17 insertions, 16 deletions
diff --git a/crates/hir_ty/src/display.rs b/crates/hir_ty/src/display.rs
index 5ff70c893..1108e5a10 100644
--- a/crates/hir_ty/src/display.rs
+++ b/crates/hir_ty/src/display.rs
@@ -251,7 +251,7 @@ impl HirDisplay for ProjectionTy {
251 } 251 }
252 252
253 let trait_ = f.db.trait_data(self.trait_(f.db)); 253 let trait_ = f.db.trait_data(self.trait_(f.db));
254 let first_parameter = self.self_type_parameter().into_displayable( 254 let first_parameter = self.self_type_parameter(&Interner).into_displayable(
255 f.db, 255 f.db,
256 f.max_size, 256 f.max_size,
257 f.omit_verbose_types, 257 f.omit_verbose_types,
@@ -592,20 +592,21 @@ impl HirDisplay for Ty {
592 } 592 }
593 TypeParamProvenance::ArgumentImplTrait => { 593 TypeParamProvenance::ArgumentImplTrait => {
594 let substs = generics.type_params_subst(f.db); 594 let substs = generics.type_params_subst(f.db);
595 let bounds = f 595 let bounds =
596 .db 596 f.db.generic_predicates(id.parent)
597 .generic_predicates(id.parent) 597 .into_iter()
598 .into_iter() 598 .map(|pred| pred.clone().subst(&substs))
599 .map(|pred| pred.clone().subst(&substs)) 599 .filter(|wc| match &wc.skip_binders() {
600 .filter(|wc| match &wc.skip_binders() { 600 WhereClause::Implemented(tr) => {
601 WhereClause::Implemented(tr) => tr.self_type_parameter() == self, 601 tr.self_type_parameter(&Interner) == self
602 WhereClause::AliasEq(AliasEq { 602 }
603 alias: AliasTy::Projection(proj), 603 WhereClause::AliasEq(AliasEq {
604 ty: _, 604 alias: AliasTy::Projection(proj),
605 }) => proj.self_type_parameter() == self, 605 ty: _,
606 _ => false, 606 }) => proj.self_type_parameter(&Interner) == self,
607 }) 607 _ => false,
608 .collect::<Vec<_>>(); 608 })
609 .collect::<Vec<_>>();
609 write_bounds_like_dyn_trait_with_prefix("impl", &bounds, f)?; 610 write_bounds_like_dyn_trait_with_prefix("impl", &bounds, f)?;
610 } 611 }
611 } 612 }
@@ -780,7 +781,7 @@ impl TraitRef {
780 return write!(f, "{}", TYPE_HINT_TRUNCATION); 781 return write!(f, "{}", TYPE_HINT_TRUNCATION);
781 } 782 }
782 783
783 self.self_type_parameter().hir_fmt(f)?; 784 self.self_type_parameter(&Interner).hir_fmt(f)?;
784 if use_as { 785 if use_as {
785 write!(f, " as ")?; 786 write!(f, " as ")?;
786 } else { 787 } else {