@@ -448,6 +448,12 @@ impl<'tcx> Visitor<'tcx> for ExtraComments<'tcx> {
448
448
self . push ( & format ! ( "+ user_ty: {:?}" , user_ty) ) ;
449
449
}
450
450
451
+ let fmt_val = |val : & ConstValue < ' tcx > | match val {
452
+ ConstValue :: Scalar ( s) => format ! ( "Scalar({:?})" , s) ,
453
+ ConstValue :: Slice { .. } => format ! ( "Slice(..)" ) ,
454
+ ConstValue :: ByRef { .. } => format ! ( "ByRef(..)" ) ,
455
+ } ;
456
+
451
457
let val = match literal {
452
458
ConstantKind :: Ty ( ct) => match ct. val ( ) {
453
459
ty:: ConstKind :: Param ( p) => format ! ( "Param({})" , p) ,
@@ -457,7 +463,7 @@ impl<'tcx> Visitor<'tcx> for ExtraComments<'tcx> {
457
463
uv. substs,
458
464
uv. promoted,
459
465
) ,
460
- ty:: ConstKind :: Value ( val) => format ! ( "Value({:? })" , val) ,
466
+ ty:: ConstKind :: Value ( val) => format ! ( "Value({})" , fmt_val ( & val) ) ,
461
467
ty:: ConstKind :: Error ( _) => "Error" . to_string ( ) ,
462
468
// These variants shouldn't exist in the MIR.
463
469
ty:: ConstKind :: Placeholder ( _)
@@ -467,7 +473,7 @@ impl<'tcx> Visitor<'tcx> for ExtraComments<'tcx> {
467
473
// To keep the diffs small, we render this like we render `ty::Const::Value`.
468
474
//
469
475
// This changes once `ty::Const::Value` is represented using valtrees.
470
- ConstantKind :: Val ( val, _) => format ! ( "Value({:? })" , val) ,
476
+ ConstantKind :: Val ( val, _) => format ! ( "Value({})" , fmt_val ( & val) ) ,
471
477
} ;
472
478
473
479
self . push ( & format ! ( "+ literal: Const {{ ty: {}, val: {} }}" , literal. ty( ) , val) ) ;
0 commit comments