Preserve output of raw pointers in mir dump.

This commit is contained in:
ben
2019-10-10 22:01:55 +13:00
parent 89cc0467a2
commit 8569dd1db9
+8 -1
View File
@@ -2602,7 +2602,14 @@ fn fmt(&self, fmt: &mut Formatter<'_>) -> fmt::Result {
impl<'tcx> Display for Constant<'tcx> {
fn fmt(&self, fmt: &mut Formatter<'_>) -> fmt::Result {
write!(fmt, "const ")?;
write!(fmt, "{}", self.literal)
// FIXME make the default pretty printing of raw pointers more detailed. Here we output the
// debug representation of raw pointers, so that the raw pointers in the mir dump output are
// detailed and just not '{pointer}'.
if let ty::RawPtr(_) = self.literal.ty.kind {
write!(fmt, "{:?} : {}", self.literal.val, self.literal.ty)
} else {
write!(fmt, "{}", self.literal)
}
}
}