about summary refs log tree commit diff
path: root/src/librustc
diff options
context:
space:
mode:
authorOliver Scherer <github35764891676564198441@oli-obk.de>2019-12-23 17:41:06 +0100
committerOliver Scherer <github35764891676564198441@oli-obk.de>2020-01-24 16:20:58 +0100
commit9a2d5e87d69cf2583db5c6dffaf82d43004a35e0 (patch)
treef60e2de65a39469873c7ccd654498dea73d0e771 /src/librustc
parentdee12bb2b7d75cce8fc8f21b5d7ea0da920df5e5 (diff)
downloadrust-9a2d5e87d69cf2583db5c6dffaf82d43004a35e0.tar.gz
rust-9a2d5e87d69cf2583db5c6dffaf82d43004a35e0.zip
Render const pointers in MIR more compactly
Diffstat (limited to 'src/librustc')
-rw-r--r--src/librustc/mir/interpret/mod.rs8
-rw-r--r--src/librustc/mir/interpret/pointer.rs4
2 files changed, 9 insertions, 3 deletions
diff --git a/src/librustc/mir/interpret/mod.rs b/src/librustc/mir/interpret/mod.rs
index e554b280ef7..54e196f4b33 100644
--- a/src/librustc/mir/interpret/mod.rs
+++ b/src/librustc/mir/interpret/mod.rs
@@ -166,9 +166,15 @@ pub enum LitToConstError {
     Reported,
 }
 
-#[derive(Copy, Clone, Eq, Hash, Ord, PartialEq, PartialOrd, Debug)]
+#[derive(Copy, Clone, Eq, Hash, Ord, PartialEq, PartialOrd)]
 pub struct AllocId(pub u64);
 
+impl fmt::Debug for AllocId {
+    fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
+        write!(fmt, "alloc{}", self.0)
+    }
+}
+
 impl rustc_serialize::UseSpecializedEncodable for AllocId {}
 impl rustc_serialize::UseSpecializedDecodable for AllocId {}
 
diff --git a/src/librustc/mir/interpret/pointer.rs b/src/librustc/mir/interpret/pointer.rs
index 9b0399e22c5..a4974fb541b 100644
--- a/src/librustc/mir/interpret/pointer.rs
+++ b/src/librustc/mir/interpret/pointer.rs
@@ -133,13 +133,13 @@ static_assert_size!(Pointer, 16);
 
 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, "{:?}+{: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, "{:?}+{:x}", self.alloc_id, self.offset.bytes())
     }
 }