Skip to content

Commit

Permalink
fn ptr pretty printing: fall back to raw ptr printing
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfJung committed Feb 20, 2021
1 parent b08bc78 commit e906745
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions compiler/rustc_middle/src/ty/print/pretty.rs
Expand Up @@ -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| {
Expand All @@ -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
Expand Down

0 comments on commit e906745

Please sign in to comment.