@@ -2132,23 +2132,37 @@ fn item_trait(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
21322132 <ul class='item-list' id='implementors-list'>
21332133 " ) ?;
21342134 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 ( ) ;
21362138 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+ _ => { }
21392152 }
21402153 }
21412154
21422155 for implementor in implementors {
21432156 write ! ( w, "<li><code>" ) ?;
21442157 // If there's already another implementor that has the same abbridged name, use the
21452158 // 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 ,
21522166 } ;
21532167 fmt_impl_for_trait_page ( & implementor. impl_ , w, use_absolute) ?;
21542168 writeln ! ( w, "</code></li>" ) ?;
0 commit comments