Skip to content

Commit 8569dd1

Browse files
committed
Preserve output of raw pointers in mir dump.
1 parent 89cc046 commit 8569dd1

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/librustc/mir/mod.rs

+8-1
Original file line numberDiff line numberDiff line change
@@ -2602,7 +2602,14 @@ impl<'tcx> Debug for Constant<'tcx> {
26022602
impl<'tcx> Display for Constant<'tcx> {
26032603
fn fmt(&self, fmt: &mut Formatter<'_>) -> fmt::Result {
26042604
write!(fmt, "const ")?;
2605-
write!(fmt, "{}", self.literal)
2605+
// FIXME make the default pretty printing of raw pointers more detailed. Here we output the
2606+
// debug representation of raw pointers, so that the raw pointers in the mir dump output are
2607+
// detailed and just not '{pointer}'.
2608+
if let ty::RawPtr(_) = self.literal.ty.kind {
2609+
write!(fmt, "{:?} : {}", self.literal.val, self.literal.ty)
2610+
} else {
2611+
write!(fmt, "{}", self.literal)
2612+
}
26062613
}
26072614
}
26082615

0 commit comments

Comments
 (0)