@@ -59,15 +59,25 @@ fn fn_sig(f: &mut fmt::Formatter,
59
59
60
60
pub fn parameterized ( f : & mut fmt:: Formatter ,
61
61
substs : & subst:: Substs ,
62
- did : DefId ,
62
+ mut did : DefId ,
63
63
projections : & [ ty:: ProjectionPredicate ] )
64
64
-> 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
+
65
76
let mut verbose = false ;
66
77
let mut num_supplied_defaults = 0 ;
67
78
let mut has_self = false ;
68
79
let mut num_regions = 0 ;
69
80
let mut num_types = 0 ;
70
- let mut item_name = None ;
71
81
let mut is_value_path = false ;
72
82
let fn_trait_kind = ty:: tls:: with ( |tcx| {
73
83
// Unfortunately, some kinds of items (e.g., closures) don't have
@@ -113,9 +123,10 @@ pub fn parameterized(f: &mut fmt::Formatter,
113
123
write ! ( f, "<{} as " , substs. type_at( 0 ) ) ?;
114
124
}
115
125
116
- item_name = Some ( tcx. item_name ( did) ) ;
117
126
path_def_id = def_id;
118
127
} else {
128
+ item_name = None ;
129
+
119
130
if is_value_path {
120
131
// Functions.
121
132
assert_eq ! ( has_self, false ) ;
0 commit comments