@@ -118,7 +118,8 @@ impl Debug for PlaceholderIndex {
118118
119119impl < TF : TypeFamily > Debug for ApplicationTy < TF > {
120120 fn fmt ( & self , fmt : & mut Formatter ) -> Result < ( ) , Error > {
121- write ! ( fmt, "{:?}{:?}" , self . name, Angle ( & self . parameters) )
121+ let ApplicationTy { name, substitution } = self ;
122+ write ! ( fmt, "{:?}{:?}" , name, substitution. with_angle( ) )
122123 }
123124}
124125
@@ -153,13 +154,14 @@ struct SeparatorTraitRef<'me, TF: TypeFamily> {
153154
154155impl < TF : TypeFamily > Debug for SeparatorTraitRef < ' _ , TF > {
155156 fn fmt ( & self , fmt : & mut Formatter ) -> Result < ( ) , Error > {
157+ let parameters = self . trait_ref . substitution . parameters ( ) ;
156158 write ! (
157159 fmt,
158160 "{:?}{}{:?}{:?}" ,
159- self . trait_ref . parameters[ 0 ] ,
161+ parameters[ 0 ] ,
160162 self . separator,
161163 self . trait_ref. trait_id,
162- Angle ( & self . trait_ref . parameters[ 1 ..] )
164+ Angle ( & parameters[ 1 ..] )
163165 )
164166 }
165167}
@@ -171,7 +173,7 @@ impl<TF: TypeFamily> Debug for ProjectionTy<TF> {
171173 fmt,
172174 "({:?}){:?}" ,
173175 self . associated_ty_id,
174- Angle ( & self . parameters )
176+ self . substitution . with_angle ( )
175177 )
176178 } )
177179 }
@@ -245,13 +247,9 @@ impl<TF: TypeFamily> Debug for DomainGoal<TF> {
245247 DomainGoal :: IsLocal ( n) => write ! ( fmt, "IsLocal({:?})" , n) ,
246248 DomainGoal :: IsUpstream ( n) => write ! ( fmt, "IsUpstream({:?})" , n) ,
247249 DomainGoal :: IsFullyVisible ( n) => write ! ( fmt, "IsFullyVisible({:?})" , n) ,
248- DomainGoal :: LocalImplAllowed ( tr) => write ! (
249- fmt,
250- "LocalImplAllowed({:?}: {:?}{:?})" ,
251- tr. parameters[ 0 ] ,
252- tr. trait_id,
253- Angle ( & tr. parameters[ 1 ..] )
254- ) ,
250+ DomainGoal :: LocalImplAllowed ( tr) => {
251+ write ! ( fmt, "LocalImplAllowed({:?})" , tr. with_colon( ) , )
252+ }
255253 DomainGoal :: Compatible ( _) => write ! ( fmt, "Compatible" ) ,
256254 DomainGoal :: DownstreamType ( n) => write ! ( fmt, "DownstreamType({:?})" , n) ,
257255 }
@@ -416,9 +414,17 @@ impl<TF: TypeFamily> Display for ConstrainedSubst<TF> {
416414 }
417415}
418416
417+ impl < TF : TypeFamily > Substitution < TF > {
418+ /// Displays the substitution in the form `< P0, .. Pn >`, or (if
419+ /// the substitution is empty) as an empty string.
420+ pub fn with_angle ( & self ) -> Angle < ' _ , Parameter < TF > > {
421+ Angle ( self . parameters ( ) )
422+ }
423+ }
424+
419425impl < TF : TypeFamily > Debug for Substitution < TF > {
420- fn fmt ( & self , f : & mut Formatter ) -> Result < ( ) , Error > {
421- Display :: fmt ( self , f )
426+ fn fmt ( & self , fmt : & mut Formatter ) -> Result < ( ) , Error > {
427+ Display :: fmt ( self , fmt )
422428 }
423429}
424430
@@ -428,7 +434,7 @@ impl<TF: TypeFamily> Display for Substitution<TF> {
428434
429435 write ! ( f, "[" ) ?;
430436
431- for ( index, value) in self . parameters . iter ( ) . enumerate ( ) {
437+ for ( index, value) in self . iter ( ) . enumerate ( ) {
432438 if first {
433439 first = false ;
434440 } else {
0 commit comments