@@ -533,14 +533,7 @@ pub trait PrettyPrinter<'tcx>:
533533 ty:: Error => p ! ( write( "[type error]" ) ) ,
534534 ty:: Param ( ref param_ty) => p ! ( write( "{}" , param_ty) ) ,
535535 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 ) ?,
544537 ty:: BoundTyKind :: Param ( p) => p ! ( write( "{}" , p) ) ,
545538 } ,
546539 ty:: Adt ( def, substs) => {
@@ -718,6 +711,18 @@ pub trait PrettyPrinter<'tcx>:
718711 Ok ( self )
719712 }
720713
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+
721726 fn infer_ty_name ( & self , _: ty:: TyVid ) -> Option < String > {
722727 None
723728 }
@@ -905,7 +910,10 @@ pub trait PrettyPrinter<'tcx>:
905910 return self . pretty_print_const_value ( value, ct. ty , print_ty) ;
906911 }
907912
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 ( _) => {
909917 // fallback
910918 if print_ty {
911919 self = self . typed_value (
0 commit comments