Skip to content

Commit

Permalink
Preserve output of raw pointers in mir dump.
Browse files Browse the repository at this point in the history
  • Loading branch information
skinnyBat committed Oct 10, 2019
1 parent 89cc046 commit 8569dd1
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/librustc/mir/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2602,7 +2602,14 @@ impl<'tcx> Debug for Constant<'tcx> {
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)
}
}
}

Expand Down

0 comments on commit 8569dd1

Please sign in to comment.