@@ -533,14 +533,7 @@ pub trait PrettyPrinter<'tcx>:
533
533
ty:: Error => p ! ( write( "[type error]" ) ) ,
534
534
ty:: Param ( ref param_ty) => p ! ( write( "{}" , param_ty) ) ,
535
535
ty:: Bound ( debruijn, bound_ty) => match bound_ty. kind {
536
- ty:: BoundTyKind :: Anon => {
537
- if debruijn == ty:: INNERMOST {
538
- p ! ( write( "^{}" , bound_ty. var. index( ) ) )
539
- } else {
540
- p ! ( write( "^{}_{}" , debruijn. index( ) , bound_ty. var. index( ) ) )
541
- }
542
- }
543
-
536
+ ty:: BoundTyKind :: Anon => self . pretty_print_bound_var ( debruijn, bound_ty. var ) ?,
544
537
ty:: BoundTyKind :: Param ( p) => p ! ( write( "{}" , p) ) ,
545
538
} ,
546
539
ty:: Adt ( def, substs) => {
@@ -718,6 +711,18 @@ pub trait PrettyPrinter<'tcx>:
718
711
Ok ( self )
719
712
}
720
713
714
+ fn pretty_print_bound_var (
715
+ & mut self ,
716
+ debruijn : ty:: DebruijnIndex ,
717
+ var : ty:: BoundVar ,
718
+ ) -> Result < ( ) , Self :: Error > {
719
+ if debruijn == ty:: INNERMOST {
720
+ write ! ( self , "^{}" , var. index( ) )
721
+ } else {
722
+ write ! ( self , "^{}_{}" , debruijn. index( ) , var. index( ) )
723
+ }
724
+ }
725
+
721
726
fn infer_ty_name ( & self , _: ty:: TyVid ) -> Option < String > {
722
727
None
723
728
}
@@ -905,7 +910,10 @@ pub trait PrettyPrinter<'tcx>:
905
910
return self . pretty_print_const_value ( value, ct. ty , print_ty) ;
906
911
}
907
912
908
- ty:: ConstKind :: Bound ( ..) | ty:: ConstKind :: Placeholder ( _) => {
913
+ ty:: ConstKind :: Bound ( debruijn, bound_var) => {
914
+ self . pretty_print_bound_var ( debruijn, bound_var) ?
915
+ }
916
+ ty:: ConstKind :: Placeholder ( _) => {
909
917
// fallback
910
918
if print_ty {
911
919
self = self . typed_value (
0 commit comments