about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNiko Matsakis <niko@alum.mit.edu>2014-12-03 12:56:03 -0500
committerNiko Matsakis <niko@alum.mit.edu>2014-12-22 12:27:08 -0500
commit69a1d0e610179e9fb7544764161e52b5d8f5faf3 (patch)
tree9bebe2539cc7853ea6258f4828f955903c2d4fbb
parent41ef2d85a1c685002230e0c05165c115b502486b (diff)
downloadrust-69a1d0e610179e9fb7544764161e52b5d8f5faf3.tar.gz
rust-69a1d0e610179e9fb7544764161e52b5d8f5faf3.zip
Change print out to include the path to the fn, a bit ad-hoc for now .
-rw-r--r--src/librustc/util/ppaux.rs16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/librustc/util/ppaux.rs b/src/librustc/util/ppaux.rs
index daa7c13e3b3..476d9949812 100644
--- a/src/librustc/util/ppaux.rs
+++ b/src/librustc/util/ppaux.rs
@@ -254,12 +254,14 @@ pub fn vec_map_to_string<T, F>(ts: &[T], f: F) -> String where
 
 pub fn ty_to_string<'tcx>(cx: &ctxt<'tcx>, typ: &ty::TyS<'tcx>) -> String {
     fn bare_fn_to_string<'tcx>(cx: &ctxt<'tcx>,
+                               opt_def_id: Option<ast::DefId>,
                                unsafety: ast::Unsafety,
                                abi: abi::Abi,
                                ident: Option<ast::Ident>,
                                sig: &ty::PolyFnSig<'tcx>)
                                -> String {
         let mut s = String::new();
+
         match unsafety {
             ast::Unsafety::Normal => {}
             ast::Unsafety::Unsafe => {
@@ -284,6 +286,16 @@ pub fn ty_to_string<'tcx>(cx: &ctxt<'tcx>, typ: &ty::TyS<'tcx>) -> String {
 
         push_sig_to_string(cx, &mut s, '(', ')', sig, "");
 
+        match opt_def_id {
+            Some(def_id) => {
+                s.push_str(" {");
+                let path_str = ty::item_path_str(cx, def_id);
+                s.push_str(path_str[]);
+                s.push_str("}");
+            }
+            None => { }
+        }
+
         s
     }
 
@@ -408,8 +420,8 @@ pub fn ty_to_string<'tcx>(cx: &ctxt<'tcx>, typ: &ty::TyS<'tcx>) -> String {
         ty_closure(ref f) => {
             closure_to_string(cx, &**f)
         }
-        ty_bare_fn(_, ref f) => {
-            bare_fn_to_string(cx, f.unsafety, f.abi, None, &f.sig)
+        ty_bare_fn(opt_def_id, ref f) => {
+            bare_fn_to_string(cx, opt_def_id, f.unsafety, f.abi, None, &f.sig)
         }
         ty_infer(infer_ty) => infer_ty_to_string(cx, infer_ty),
         ty_err => "[type error]".to_string(),