Skip to content

Commit e906745

Browse files
committed
fn ptr pretty printing: fall back to raw ptr printing
1 parent b08bc78 commit e906745

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

compiler/rustc_middle/src/ty/print/pretty.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1018,7 +1018,7 @@ pub trait PrettyPrinter<'tcx>:
10181018
p!(write("{:?}", char::try_from(int).unwrap()))
10191019
}
10201020
// Raw pointers
1021-
(Scalar::Int(int), ty::RawPtr(_)) => {
1021+
(Scalar::Int(int), ty::RawPtr(_) | ty::FnPtr(_)) => {
10221022
let data = int.assert_bits(self.tcx().data_layout.pointer_size);
10231023
self = self.typed_value(
10241024
|mut this| {
@@ -1040,8 +1040,7 @@ pub trait PrettyPrinter<'tcx>:
10401040
" as ",
10411041
)?;
10421042
}
1043-
Some(_) => p!("<non-executable memory>"),
1044-
None => p!("<dangling pointer>"),
1043+
_ => self = self.pretty_print_const_pointer(ptr, ty, print_ty)?,
10451044
}
10461045
}
10471046
// For function type zsts just printing the path is enough

0 commit comments

Comments
 (0)