Skip to content

Commit 69a1d0e

Browse files
committed
Change print out to include the path to the fn, a bit ad-hoc for now .
1 parent 41ef2d8 commit 69a1d0e

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/librustc/util/ppaux.rs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,12 +254,14 @@ pub fn vec_map_to_string<T, F>(ts: &[T], f: F) -> String where
254254

255255
pub fn ty_to_string<'tcx>(cx: &ctxt<'tcx>, typ: &ty::TyS<'tcx>) -> String {
256256
fn bare_fn_to_string<'tcx>(cx: &ctxt<'tcx>,
257+
opt_def_id: Option<ast::DefId>,
257258
unsafety: ast::Unsafety,
258259
abi: abi::Abi,
259260
ident: Option<ast::Ident>,
260261
sig: &ty::PolyFnSig<'tcx>)
261262
-> String {
262263
let mut s = String::new();
264+
263265
match unsafety {
264266
ast::Unsafety::Normal => {}
265267
ast::Unsafety::Unsafe => {
@@ -284,6 +286,16 @@ pub fn ty_to_string<'tcx>(cx: &ctxt<'tcx>, typ: &ty::TyS<'tcx>) -> String {
284286

285287
push_sig_to_string(cx, &mut s, '(', ')', sig, "");
286288

289+
match opt_def_id {
290+
Some(def_id) => {
291+
s.push_str(" {");
292+
let path_str = ty::item_path_str(cx, def_id);
293+
s.push_str(path_str[]);
294+
s.push_str("}");
295+
}
296+
None => { }
297+
}
298+
287299
s
288300
}
289301

@@ -408,8 +420,8 @@ pub fn ty_to_string<'tcx>(cx: &ctxt<'tcx>, typ: &ty::TyS<'tcx>) -> String {
408420
ty_closure(ref f) => {
409421
closure_to_string(cx, &**f)
410422
}
411-
ty_bare_fn(_, ref f) => {
412-
bare_fn_to_string(cx, f.unsafety, f.abi, None, &f.sig)
423+
ty_bare_fn(opt_def_id, ref f) => {
424+
bare_fn_to_string(cx, opt_def_id, f.unsafety, f.abi, None, &f.sig)
413425
}
414426
ty_infer(infer_ty) => infer_ty_to_string(cx, infer_ty),
415427
ty_err => "[type error]".to_string(),

0 commit comments

Comments
 (0)