diff options
Diffstat (limited to 'crates/hir_ty/src/display.rs')
-rw-r--r-- | crates/hir_ty/src/display.rs | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/crates/hir_ty/src/display.rs b/crates/hir_ty/src/display.rs index e6473586b..378c951c5 100644 --- a/crates/hir_ty/src/display.rs +++ b/crates/hir_ty/src/display.rs | |||
@@ -245,19 +245,19 @@ impl HirDisplay for ProjectionTy { | |||
245 | } | 245 | } |
246 | 246 | ||
247 | let trait_ = f.db.trait_data(self.trait_(f.db)); | 247 | let trait_ = f.db.trait_data(self.trait_(f.db)); |
248 | let first_parameter = self.parameters[0].into_displayable( | 248 | let first_parameter = self.substitution[0].into_displayable( |
249 | f.db, | 249 | f.db, |
250 | f.max_size, | 250 | f.max_size, |
251 | f.omit_verbose_types, | 251 | f.omit_verbose_types, |
252 | f.display_target, | 252 | f.display_target, |
253 | ); | 253 | ); |
254 | write!(f, "<{} as {}", first_parameter, trait_.name)?; | 254 | write!(f, "<{} as {}", first_parameter, trait_.name)?; |
255 | if self.parameters.len() > 1 { | 255 | if self.substitution.len() > 1 { |
256 | write!(f, "<")?; | 256 | write!(f, "<")?; |
257 | f.write_joined(&self.parameters[1..], ", ")?; | 257 | f.write_joined(&self.substitution[1..], ", ")?; |
258 | write!(f, ">")?; | 258 | write!(f, ">")?; |
259 | } | 259 | } |
260 | write!(f, ">::{}", f.db.type_alias_data(from_assoc_type_id(self.associated_ty)).name)?; | 260 | write!(f, ">::{}", f.db.type_alias_data(from_assoc_type_id(self.associated_ty_id)).name)?; |
261 | Ok(()) | 261 | Ok(()) |
262 | } | 262 | } |
263 | } | 263 | } |
@@ -319,7 +319,10 @@ impl HirDisplay for Ty { | |||
319 | TyKind::Dyn(predicates) if predicates.len() > 1 => { | 319 | TyKind::Dyn(predicates) if predicates.len() > 1 => { |
320 | Cow::Borrowed(predicates.as_ref()) | 320 | Cow::Borrowed(predicates.as_ref()) |
321 | } | 321 | } |
322 | &TyKind::Alias(AliasTy::Opaque(OpaqueTy { opaque_ty_id, ref parameters })) => { | 322 | &TyKind::Alias(AliasTy::Opaque(OpaqueTy { |
323 | opaque_ty_id, | ||
324 | substitution: ref parameters, | ||
325 | })) => { | ||
323 | let impl_trait_id = f.db.lookup_intern_impl_trait_id(opaque_ty_id.into()); | 326 | let impl_trait_id = f.db.lookup_intern_impl_trait_id(opaque_ty_id.into()); |
324 | if let ImplTraitId::ReturnTypeImplTrait(func, idx) = impl_trait_id { | 327 | if let ImplTraitId::ReturnTypeImplTrait(func, idx) = impl_trait_id { |
325 | datas = | 328 | datas = |
@@ -491,8 +494,8 @@ impl HirDisplay for Ty { | |||
491 | } | 494 | } |
492 | } else { | 495 | } else { |
493 | let projection_ty = ProjectionTy { | 496 | let projection_ty = ProjectionTy { |
494 | associated_ty: to_assoc_type_id(type_alias), | 497 | associated_ty_id: to_assoc_type_id(type_alias), |
495 | parameters: parameters.clone(), | 498 | substitution: parameters.clone(), |
496 | }; | 499 | }; |
497 | 500 | ||
498 | projection_ty.hir_fmt(f)?; | 501 | projection_ty.hir_fmt(f)?; |
@@ -579,7 +582,7 @@ impl HirDisplay for Ty { | |||
579 | let data = (*datas) | 582 | let data = (*datas) |
580 | .as_ref() | 583 | .as_ref() |
581 | .map(|rpit| rpit.impl_traits[idx as usize].bounds.clone()); | 584 | .map(|rpit| rpit.impl_traits[idx as usize].bounds.clone()); |
582 | let bounds = data.subst(&opaque_ty.parameters); | 585 | let bounds = data.subst(&opaque_ty.substitution); |
583 | write_bounds_like_dyn_trait_with_prefix("impl", &bounds.value, f)?; | 586 | write_bounds_like_dyn_trait_with_prefix("impl", &bounds.value, f)?; |
584 | } | 587 | } |
585 | ImplTraitId::AsyncBlockTypeImplTrait(..) => { | 588 | ImplTraitId::AsyncBlockTypeImplTrait(..) => { |
@@ -709,7 +712,7 @@ fn write_bounds_like_dyn_trait( | |||
709 | angle_open = true; | 712 | angle_open = true; |
710 | } | 713 | } |
711 | let type_alias = f.db.type_alias_data(from_assoc_type_id( | 714 | let type_alias = f.db.type_alias_data(from_assoc_type_id( |
712 | projection_pred.projection_ty.associated_ty, | 715 | projection_pred.projection_ty.associated_ty_id, |
713 | )); | 716 | )); |
714 | write!(f, "{} = ", type_alias.name)?; | 717 | write!(f, "{} = ", type_alias.name)?; |
715 | projection_pred.ty.hir_fmt(f)?; | 718 | projection_pred.ty.hir_fmt(f)?; |
@@ -782,7 +785,7 @@ impl HirDisplay for GenericPredicate { | |||
782 | f, | 785 | f, |
783 | ">::{} = ", | 786 | ">::{} = ", |
784 | f.db.type_alias_data(from_assoc_type_id( | 787 | f.db.type_alias_data(from_assoc_type_id( |
785 | projection_pred.projection_ty.associated_ty | 788 | projection_pred.projection_ty.associated_ty_id |
786 | )) | 789 | )) |
787 | .name, | 790 | .name, |
788 | )?; | 791 | )?; |