about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2021-02-20 11:34:35 +0100
committerRalf Jung <post@ralfj.de>2021-02-20 11:34:35 +0100
commite90674574d21f8245716c0644b0c8aa2e1702b54 (patch)
tree404157c18c09c76afe3d6b6a2ccc65be411024bc
parentb08bc7836be6a53e733190f3174128fe8d005737 (diff)
downloadrust-e90674574d21f8245716c0644b0c8aa2e1702b54.tar.gz
rust-e90674574d21f8245716c0644b0c8aa2e1702b54.zip
fn ptr pretty printing: fall back to raw ptr printing
-rw-r--r--compiler/rustc_middle/src/ty/print/pretty.rs5
1 files changed, 2 insertions, 3 deletions
diff --git a/compiler/rustc_middle/src/ty/print/pretty.rs b/compiler/rustc_middle/src/ty/print/pretty.rs
index f934e31a534..cc41fd855e8 100644
--- a/compiler/rustc_middle/src/ty/print/pretty.rs
+++ b/compiler/rustc_middle/src/ty/print/pretty.rs
@@ -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