@@ -254,12 +254,14 @@ pub fn vec_map_to_string<T, F>(ts: &[T], f: F) -> String where
254
254
255
255
pub fn ty_to_string < ' tcx > ( cx : & ctxt < ' tcx > , typ : & ty:: TyS < ' tcx > ) -> String {
256
256
fn bare_fn_to_string < ' tcx > ( cx : & ctxt < ' tcx > ,
257
+ opt_def_id : Option < ast:: DefId > ,
257
258
unsafety : ast:: Unsafety ,
258
259
abi : abi:: Abi ,
259
260
ident : Option < ast:: Ident > ,
260
261
sig : & ty:: PolyFnSig < ' tcx > )
261
262
-> String {
262
263
let mut s = String :: new ( ) ;
264
+
263
265
match unsafety {
264
266
ast:: Unsafety :: Normal => { }
265
267
ast:: Unsafety :: Unsafe => {
@@ -284,6 +286,16 @@ pub fn ty_to_string<'tcx>(cx: &ctxt<'tcx>, typ: &ty::TyS<'tcx>) -> String {
284
286
285
287
push_sig_to_string ( cx, & mut s, '(' , ')' , sig, "" ) ;
286
288
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
+
287
299
s
288
300
}
289
301
@@ -408,8 +420,8 @@ pub fn ty_to_string<'tcx>(cx: &ctxt<'tcx>, typ: &ty::TyS<'tcx>) -> String {
408
420
ty_closure( ref f) => {
409
421
closure_to_string ( cx, & * * f)
410
422
}
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 )
413
425
}
414
426
ty_infer( infer_ty) => infer_ty_to_string ( cx, infer_ty) ,
415
427
ty_err => "[type error]" . to_string ( ) ,
0 commit comments