@@ -2253,6 +2253,18 @@ fn item_function(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
22532253 document ( w, cx, it)
22542254}
22552255
2256+ fn implementor2item < ' a > ( cache : & ' a Cache , imp : & Implementor ) -> Option < & ' a clean:: Item > {
2257+ if let Some ( t_did) = imp. impl_ . for_ . def_id ( ) {
2258+ if let Some ( impl_item) = cache. impls . get ( & t_did) . and_then ( |i| i. iter ( )
2259+ . find ( |i| i. impl_item . def_id == imp. def_id ) )
2260+ {
2261+ let i = & impl_item. impl_item ;
2262+ return Some ( i) ;
2263+ }
2264+ }
2265+ None
2266+ }
2267+
22562268fn item_trait ( w : & mut fmt:: Formatter , cx : & Context , it : & clean:: Item ,
22572269 t : & clean:: Trait ) -> fmt:: Result {
22582270 let mut bounds = String :: new ( ) ;
@@ -2463,27 +2475,30 @@ fn item_trait(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
24632475 " ) ?;
24642476
24652477 for implementor in foreign {
2466- // need to get from a clean::Impl to a clean::Item so i can use render_impl
2467- if let Some ( t_did) = implementor. impl_ . for_ . def_id ( ) {
2468- if let Some ( impl_item) = cache. impls . get ( & t_did) . and_then ( |i| i. iter ( )
2469- . find ( |i| i. impl_item . def_id == implementor. def_id ) )
2470- {
2471- let i = & impl_item. impl_item ;
2472- let impl_ = Impl { impl_item : i. clone ( ) } ;
2473- let assoc_link = AssocItemLink :: GotoSource (
2474- i. def_id , & implementor. impl_ . provided_trait_methods
2475- ) ;
2476- render_impl ( w, cx, & impl_, assoc_link,
2477- RenderMode :: Normal , i. stable_since ( ) , false ) ?;
2478- }
2478+ if let Some ( i) = implementor2item ( & cache, implementor) {
2479+ let impl_ = Impl { impl_item : i. clone ( ) } ;
2480+ let assoc_link = AssocItemLink :: GotoSource (
2481+ i. def_id , & implementor. impl_ . provided_trait_methods
2482+ ) ;
2483+ render_impl ( w, cx, & impl_, assoc_link,
2484+ RenderMode :: Normal , i. stable_since ( ) , false ) ?;
24792485 }
24802486 }
24812487 }
24822488
24832489 write ! ( w, "{}" , impl_header) ?;
24842490
24852491 for implementor in local {
2486- write ! ( w, "<li><code>" ) ?;
2492+ write ! ( w, "<li>" ) ?;
2493+ if let Some ( item) = implementor2item ( & cache, implementor) {
2494+ if let Some ( l) = ( Item { cx, item } ) . src_href ( ) {
2495+ write ! ( w, "<div class='out-of-band'>" ) ?;
2496+ write ! ( w, "<a class='srclink' href='{}' title='{}'>[src]</a>" ,
2497+ l, "goto source code" ) ?;
2498+ write ! ( w, "</div>" ) ?;
2499+ }
2500+ }
2501+ write ! ( w, "<code>" ) ?;
24872502 // If there's already another implementor that has the same abbridged name, use the
24882503 // full path, for example in `std::iter::ExactSizeIterator`
24892504 let use_absolute = match implementor. impl_ . for_ {
0 commit comments