]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc_middle/mir/interpret/pointer.rs
Add leading 0x to offset in Debug fmt of Pointer
[rust.git] / src / librustc_middle / mir / interpret / pointer.rs
index 7549d902dfbfe8a132adb672c7a91e14f6333a0c..8434b45a1e7e795e5b7a9026d664afd7abdc5d21 100644 (file)
@@ -121,13 +121,13 @@ pub struct Pointer<Tag = (), Id = AllocId> {
 
 impl<Tag: fmt::Debug, Id: fmt::Debug> fmt::Debug for Pointer<Tag, Id> {
     default fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
-        write!(f, "{:?}+{:x}[{:?}]", self.alloc_id, self.offset.bytes(), self.tag)
+        write!(f, "{:?}+0x{:x}[{:?}]", self.alloc_id, self.offset.bytes(), self.tag)
     }
 }
 // Specialization for no tag
 impl<Id: fmt::Debug> fmt::Debug for Pointer<(), Id> {
     fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
-        write!(f, "{:?}+{:x}", self.alloc_id, self.offset.bytes())
+        write!(f, "{:?}+0x{:x}", self.alloc_id, self.offset.bytes())
     }
 }