@@ -2132,23 +2132,37 @@ fn item_trait(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
2132
2132
<ul class='item-list' id='implementors-list'>
2133
2133
" ) ?;
2134
2134
if let Some ( implementors) = cache. implementors . get ( & it. def_id ) {
2135
- let mut implementor_count: FxHashMap < & str , usize > = FxHashMap ( ) ;
2135
+ // The DefId is for the first Type found with that name. The bool is
2136
+ // if any Types with the same name but different DefId have been found.
2137
+ let mut implementor_dups: FxHashMap < & str , ( DefId , bool ) > = FxHashMap ( ) ;
2136
2138
for implementor in implementors {
2137
- if let clean:: Type :: ResolvedPath { ref path, ..} = implementor. impl_ . for_ {
2138
- * implementor_count. entry ( path. last_name ( ) ) . or_insert ( 0 ) += 1 ;
2139
+ match implementor. impl_ . for_ {
2140
+ clean:: ResolvedPath { ref path, did, is_generic : false , .. } |
2141
+ clean:: BorrowedRef {
2142
+ type_ : box clean:: ResolvedPath { ref path, did, is_generic : false , .. } ,
2143
+ ..
2144
+ } => {
2145
+ let & mut ( prev_did, ref mut has_duplicates) =
2146
+ implementor_dups. entry ( path. last_name ( ) ) . or_insert ( ( did, false ) ) ;
2147
+ if prev_did != did {
2148
+ * has_duplicates = true ;
2149
+ }
2150
+ }
2151
+ _ => { }
2139
2152
}
2140
2153
}
2141
2154
2142
2155
for implementor in implementors {
2143
2156
write ! ( w, "<li><code>" ) ?;
2144
2157
// If there's already another implementor that has the same abbridged name, use the
2145
2158
// full path, for example in `std::iter::ExactSizeIterator`
2146
- let use_absolute = if let clean:: Type :: ResolvedPath {
2147
- ref path, ..
2148
- } = implementor. impl_ . for_ {
2149
- implementor_count[ path. last_name ( ) ] > 1
2150
- } else {
2151
- false
2159
+ let use_absolute = match implementor. impl_ . for_ {
2160
+ clean:: ResolvedPath { ref path, is_generic : false , .. } |
2161
+ clean:: BorrowedRef {
2162
+ type_ : box clean:: ResolvedPath { ref path, is_generic : false , .. } ,
2163
+ ..
2164
+ } => implementor_dups[ path. last_name ( ) ] . 1 ,
2165
+ _ => false ,
2152
2166
} ;
2153
2167
fmt_impl_for_trait_page ( & implementor. impl_ , w, use_absolute) ?;
2154
2168
writeln ! ( w, "</code></li>" ) ?;
0 commit comments