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

View file

@ -2602,8 +2602,15 @@ impl<'tcx> Debug for Constant<'tcx> {
impl<'tcx> Display for Constant<'tcx> { impl<'tcx> Display for Constant<'tcx> {
fn fmt(&self, fmt: &mut Formatter<'_>) -> fmt::Result { fn fmt(&self, fmt: &mut Formatter<'_>) -> fmt::Result {
write!(fmt, "const ")?; write!(fmt, "const ")?;
// 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) write!(fmt, "{}", self.literal)
} }
}
} }
impl<'tcx> graph::DirectedGraph for Body<'tcx> { impl<'tcx> graph::DirectedGraph for Body<'tcx> {