diff options
author | Laurențiu Nicola <[email protected]> | 2021-04-05 15:38:37 +0100 |
---|---|---|
committer | Laurențiu Nicola <[email protected]> | 2021-04-05 15:38:37 +0100 |
commit | d7546d8c2323adff53c8170c528e82a8131681c5 (patch) | |
tree | 511c31f0b647044294eba7c4394ee3e4ba7b13b6 /crates/hir_ty/src/display.rs | |
parent | aefcbf275804f558ab18e83bfc8869187713b4ad (diff) |
Pass interner to TraitRef::self_type_parameter
Diffstat (limited to 'crates/hir_ty/src/display.rs')
-rw-r--r-- | crates/hir_ty/src/display.rs | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/crates/hir_ty/src/display.rs b/crates/hir_ty/src/display.rs index 965476a05..1108e5a10 100644 --- a/crates/hir_ty/src/display.rs +++ b/crates/hir_ty/src/display.rs | |||
@@ -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(&Interner) == 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 { |