@@ -858,16 +858,23 @@ pub trait PrettyPrinter<'tcx>:
858
858
859
859
macro_rules! print_underscore {
860
860
( ) => { {
861
- p!( write( "_" ) ) ;
862
861
if print_ty {
863
- p!( write( ": " ) , print( ct. ty) ) ;
862
+ self = self . typed_value(
863
+ |mut this| {
864
+ write!( this, "_" ) ?;
865
+ Ok ( this)
866
+ } ,
867
+ |this| this. print_type( ct. ty) ,
868
+ ": " ,
869
+ ) ?;
870
+ } else {
871
+ write!( self , "_" ) ?;
864
872
}
865
873
} } ;
866
874
}
867
875
868
- match ( ct. val , & ct. ty . kind ) {
869
- ( _, ty:: FnDef ( did, substs) ) => p ! ( print_value_path( * did, substs) ) ,
870
- ( ty:: ConstKind :: Unevaluated ( did, substs, promoted) , _) => {
876
+ match ct. val {
877
+ ty:: ConstKind :: Unevaluated ( did, substs, promoted) => {
871
878
if let Some ( promoted) = promoted {
872
879
p ! ( print_value_path( did, substs) ) ;
873
880
p ! ( write( "::{:?}" , promoted) ) ;
@@ -892,17 +899,25 @@ pub trait PrettyPrinter<'tcx>:
892
899
}
893
900
}
894
901
}
895
- ( ty:: ConstKind :: Infer ( ..) , _ ) => print_underscore ! ( ) ,
896
- ( ty:: ConstKind :: Param ( ParamConst { name, .. } ) , _ ) => p ! ( write( "{}" , name) ) ,
897
- ( ty:: ConstKind :: Value ( value) , _ ) => {
902
+ ty:: ConstKind :: Infer ( ..) => print_underscore ! ( ) ,
903
+ ty:: ConstKind :: Param ( ParamConst { name, .. } ) => p ! ( write( "{}" , name) ) ,
904
+ ty:: ConstKind :: Value ( value) => {
898
905
return self . pretty_print_const_value ( value, ct. ty , print_ty) ;
899
906
}
900
907
901
- _ => {
908
+ ty :: ConstKind :: Bound ( .. ) | ty :: ConstKind :: Placeholder ( _ ) => {
902
909
// fallback
903
- p ! ( write( "{:?}" , ct. val) ) ;
904
910
if print_ty {
905
- p ! ( write( ": " ) , print( ct. ty) ) ;
911
+ self = self . typed_value (
912
+ |mut this| {
913
+ write ! ( this, "{:?}" , ct. val) ?;
914
+ Ok ( this)
915
+ } ,
916
+ |this| this. print_type ( ct. ty ) ,
917
+ ": " ,
918
+ ) ?;
919
+ } else {
920
+ p ! ( write( "{:?}" , ct. val) ) ;
906
921
}
907
922
}
908
923
} ;
0 commit comments