fn ptr pretty printing: fall back to raw ptr printing

This commit is contained in:
Ralf Jung 2021-02-20 11:34:35 +01:00
parent b08bc7836b
commit e90674574d
1 changed files with 2 additions and 3 deletions

View File

@ -1018,7 +1018,7 @@ pub trait PrettyPrinter<'tcx>:
p!(write("{:?}", char::try_from(int).unwrap()))
}
// Raw pointers
(Scalar::Int(int), ty::RawPtr(_)) => {
(Scalar::Int(int), ty::RawPtr(_) | ty::FnPtr(_)) => {
let data = int.assert_bits(self.tcx().data_layout.pointer_size);
self = self.typed_value(
|mut this| {
@ -1040,8 +1040,7 @@ pub trait PrettyPrinter<'tcx>:
" as ",
)?;
}
Some(_) => p!("<non-executable memory>"),
None => p!("<dangling pointer>"),
_ => self = self.pretty_print_const_pointer(ptr, ty, print_ty)?,
}
}
// For function type zsts just printing the path is enough