@@ -59,15 +59,25 @@ fn fn_sig(f: &mut fmt::Formatter,
5959
6060pub fn parameterized ( f : & mut fmt:: Formatter ,
6161 substs : & subst:: Substs ,
62- did : DefId ,
62+ mut did : DefId ,
6363 projections : & [ ty:: ProjectionPredicate ] )
6464 -> fmt:: Result {
65+ let key = ty:: tls:: with ( |tcx| tcx. def_key ( did) ) ;
66+ let mut item_name = if let Some ( name) = key. disambiguated_data . data . get_opt_name ( ) {
67+ Some ( name)
68+ } else {
69+ did. index = key. parent . unwrap_or_else (
70+ || bug ! ( "finding type for {:?}, encountered def-id {:?} with no parent" ,
71+ did, did) ) ;
72+ parameterized ( f, substs, did, projections) ?;
73+ return write ! ( f, "::{}" , key. disambiguated_data. data. as_interned_str( ) ) ;
74+ } ;
75+
6576 let mut verbose = false ;
6677 let mut num_supplied_defaults = 0 ;
6778 let mut has_self = false ;
6879 let mut num_regions = 0 ;
6980 let mut num_types = 0 ;
70- let mut item_name = None ;
7181 let mut is_value_path = false ;
7282 let fn_trait_kind = ty:: tls:: with ( |tcx| {
7383 // Unfortunately, some kinds of items (e.g., closures) don't have
@@ -113,9 +123,10 @@ pub fn parameterized(f: &mut fmt::Formatter,
113123 write ! ( f, "<{} as " , substs. type_at( 0 ) ) ?;
114124 }
115125
116- item_name = Some ( tcx. item_name ( did) ) ;
117126 path_def_id = def_id;
118127 } else {
128+ item_name = None ;
129+
119130 if is_value_path {
120131 // Functions.
121132 assert_eq ! ( has_self, false ) ;
0 commit comments