aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_ty/src/display.rs
diff options
context:
space:
mode:
authorFlorian Diebold <[email protected]>2021-03-18 20:53:19 +0000
committerFlorian Diebold <[email protected]>2021-03-18 20:53:19 +0000
commit7a7e47eab7323a8e122d9994b2936e50e42a1af2 (patch)
treea2ad2b6faf8c708fc593546df64d489c117b61f2 /crates/hir_ty/src/display.rs
parentb70bea0d7994cbe7b1e01e6b2e0f4ab3ac2c6fd5 (diff)
Chalkify TraitRef
Diffstat (limited to 'crates/hir_ty/src/display.rs')
-rw-r--r--crates/hir_ty/src/display.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/crates/hir_ty/src/display.rs b/crates/hir_ty/src/display.rs
index 7ce0f864c..c6b4f37e5 100644
--- a/crates/hir_ty/src/display.rs
+++ b/crates/hir_ty/src/display.rs
@@ -344,7 +344,7 @@ impl HirDisplay for Ty {
344 }; 344 };
345 345
346 if let [GenericPredicate::Implemented(trait_ref), _] = predicates.as_ref() { 346 if let [GenericPredicate::Implemented(trait_ref), _] = predicates.as_ref() {
347 let trait_ = trait_ref.trait_; 347 let trait_ = trait_ref.hir_trait_id();
348 if fn_traits(f.db.upcast(), trait_).any(|it| it == trait_) { 348 if fn_traits(f.db.upcast(), trait_).any(|it| it == trait_) {
349 return write!(f, "{}", ty_display); 349 return write!(f, "{}", ty_display);
350 } 350 }
@@ -670,7 +670,7 @@ fn write_bounds_like_dyn_trait(
670 for p in predicates.iter() { 670 for p in predicates.iter() {
671 match p { 671 match p {
672 GenericPredicate::Implemented(trait_ref) => { 672 GenericPredicate::Implemented(trait_ref) => {
673 let trait_ = trait_ref.trait_; 673 let trait_ = trait_ref.hir_trait_id();
674 if !is_fn_trait { 674 if !is_fn_trait {
675 is_fn_trait = fn_traits(f.db.upcast(), trait_).any(|it| it == trait_); 675 is_fn_trait = fn_traits(f.db.upcast(), trait_).any(|it| it == trait_);
676 } 676 }
@@ -685,7 +685,7 @@ fn write_bounds_like_dyn_trait(
685 // existential) here, which is the only thing that's 685 // existential) here, which is the only thing that's
686 // possible in actual Rust, and hence don't print it 686 // possible in actual Rust, and hence don't print it
687 write!(f, "{}", f.db.trait_data(trait_).name)?; 687 write!(f, "{}", f.db.trait_data(trait_).name)?;
688 if let [_, params @ ..] = &*trait_ref.substs.0 { 688 if let [_, params @ ..] = &*trait_ref.substitution.0 {
689 if is_fn_trait { 689 if is_fn_trait {
690 if let Some(args) = params.first().and_then(|it| it.as_tuple()) { 690 if let Some(args) = params.first().and_then(|it| it.as_tuple()) {
691 write!(f, "(")?; 691 write!(f, "(")?;
@@ -745,16 +745,16 @@ impl TraitRef {
745 return write!(f, "{}", TYPE_HINT_TRUNCATION); 745 return write!(f, "{}", TYPE_HINT_TRUNCATION);
746 } 746 }
747 747
748 self.substs[0].hir_fmt(f)?; 748 self.substitution[0].hir_fmt(f)?;
749 if use_as { 749 if use_as {
750 write!(f, " as ")?; 750 write!(f, " as ")?;
751 } else { 751 } else {
752 write!(f, ": ")?; 752 write!(f, ": ")?;
753 } 753 }
754 write!(f, "{}", f.db.trait_data(self.trait_).name)?; 754 write!(f, "{}", f.db.trait_data(self.hir_trait_id()).name)?;
755 if self.substs.len() > 1 { 755 if self.substitution.len() > 1 {
756 write!(f, "<")?; 756 write!(f, "<")?;
757 f.write_joined(&self.substs[1..], ", ")?; 757 f.write_joined(&self.substitution[1..], ", ")?;
758 write!(f, ">")?; 758 write!(f, ">")?;
759 } 759 }
760 Ok(()) 760 Ok(())