@@ -107,6 +107,8 @@ pub enum Scalar<Tag = (), Id = AllocId> {
107107#[ cfg( target_arch = "x86_64" ) ]
108108static_assert_size ! ( Scalar , 24 ) ;
109109
110+ // We want the `Debug` output to be readable as it is used by `derive(Debug)` for
111+ // all the Miri types.
110112impl < Tag : fmt:: Debug , Id : fmt:: Debug > fmt:: Debug for Scalar < Tag , Id > {
111113 fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
112114 match self {
@@ -125,11 +127,11 @@ impl<Tag: fmt::Debug, Id: fmt::Debug> fmt::Debug for Scalar<Tag, Id> {
125127 }
126128}
127129
128- impl < Tag > fmt:: Display for Scalar < Tag > {
130+ impl < Tag : fmt :: Debug > fmt:: Display for Scalar < Tag > {
129131 fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
130132 match self {
131- Scalar :: Ptr ( _ ) => write ! ( f, "a pointer" ) ,
132- Scalar :: Raw { data , .. } => write ! ( f , "{}" , data ) ,
133+ Scalar :: Ptr ( ptr ) => write ! ( f, "pointer to {}" , ptr ) ,
134+ Scalar :: Raw { .. } => fmt :: Debug :: fmt ( self , f ) ,
133135 }
134136 }
135137}
@@ -559,16 +561,18 @@ impl<Tag> From<Pointer<Tag>> for ScalarMaybeUndef<Tag> {
559561 }
560562}
561563
564+ // We want the `Debug` output to be readable as it is used by `derive(Debug)` for
565+ // all the Miri types.
562566impl < Tag : fmt:: Debug , Id : fmt:: Debug > fmt:: Debug for ScalarMaybeUndef < Tag , Id > {
563567 fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
564568 match self {
565- ScalarMaybeUndef :: Undef => write ! ( f, "Undef " ) ,
569+ ScalarMaybeUndef :: Undef => write ! ( f, "<uninitialized> " ) ,
566570 ScalarMaybeUndef :: Scalar ( s) => write ! ( f, "{:?}" , s) ,
567571 }
568572 }
569573}
570574
571- impl < Tag > fmt:: Display for ScalarMaybeUndef < Tag > {
575+ impl < Tag : fmt :: Debug > fmt:: Display for ScalarMaybeUndef < Tag > {
572576 fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
573577 match self {
574578 ScalarMaybeUndef :: Undef => write ! ( f, "uninitialized bytes" ) ,
0 commit comments