@@ -992,13 +992,11 @@ themePicker.onblur = handleThemeButtonsBlur;
992992 writeln ! ( v, "{}" , * implementor) . unwrap ( ) ;
993993 }
994994 v. push_str (
995- r"
996- if (window.register_implementors) {
997- window.register_implementors(implementors);
998- } else {
999- window.pending_implementors = implementors;
1000- }
1001- " ,
995+ "if (window.register_implementors) {\
996+ window.register_implementors(implementors);\
997+ } else {\
998+ window.pending_implementors = implementors;\
999+ }",
10021000 ) ;
10031001 v. push_str ( "})()" ) ;
10041002 cx. shared . fs . write ( & mydst, & v) ?;
@@ -2353,6 +2351,7 @@ fn render_implementor(
23532351 implementor : & Impl ,
23542352 w : & mut Buffer ,
23552353 implementor_dups : & FxHashMap < & str , ( DefId , bool ) > ,
2354+ aliases : & [ String ] ,
23562355) {
23572356 // If there's already another implementor that has the same abbridged name, use the
23582357 // full path, for example in `std::iter::ExactSizeIterator`
@@ -2375,6 +2374,7 @@ fn render_implementor(
23752374 Some ( use_absolute) ,
23762375 false ,
23772376 false ,
2377+ aliases,
23782378 ) ;
23792379}
23802380
@@ -2396,6 +2396,7 @@ fn render_impls(cx: &Context, w: &mut Buffer, traits: &[&&Impl], containing_item
23962396 None ,
23972397 false ,
23982398 true ,
2399+ & [ ] ,
23992400 ) ;
24002401 buffer. into_inner ( )
24012402 } )
@@ -2597,8 +2598,6 @@ fn item_trait(w: &mut Buffer, cx: &Context, it: &clean::Item, t: &clean::Trait)
25972598 // If there are methods directly on this trait object, render them here.
25982599 render_assoc_items ( w, cx, it, it. def_id , AssocItemRender :: All ) ;
25992600
2600- let mut synthetic_types = Vec :: new ( ) ;
2601-
26022601 if let Some ( implementors) = cx. cache . implementors . get ( & it. def_id ) {
26032602 // The DefId is for the first Type found with that name. The bool is
26042603 // if any Types with the same name but different DefId have been found.
@@ -2649,6 +2648,7 @@ fn item_trait(w: &mut Buffer, cx: &Context, it: &clean::Item, t: &clean::Trait)
26492648 None ,
26502649 true ,
26512650 false ,
2651+ & [ ] ,
26522652 ) ;
26532653 }
26542654 write_loading_content ( w, "" ) ;
@@ -2661,7 +2661,7 @@ fn item_trait(w: &mut Buffer, cx: &Context, it: &clean::Item, t: &clean::Trait)
26612661 "<div class='item-list' id='implementors-list'>" ,
26622662 ) ;
26632663 for implementor in concrete {
2664- render_implementor ( cx, implementor, w, & implementor_dups) ;
2664+ render_implementor ( cx, implementor, w, & implementor_dups, & [ ] ) ;
26652665 }
26662666 write_loading_content ( w, "</div>" ) ;
26672667
@@ -2673,9 +2673,13 @@ fn item_trait(w: &mut Buffer, cx: &Context, it: &clean::Item, t: &clean::Trait)
26732673 "<div class='item-list' id='synthetic-implementors-list'>" ,
26742674 ) ;
26752675 for implementor in synthetic {
2676- synthetic_types
2677- . extend ( collect_paths_for_type ( implementor. inner_impl ( ) . for_ . clone ( ) ) ) ;
2678- render_implementor ( cx, implementor, w, & implementor_dups) ;
2676+ render_implementor (
2677+ cx,
2678+ implementor,
2679+ w,
2680+ & implementor_dups,
2681+ & collect_paths_for_type ( implementor. inner_impl ( ) . for_ . clone ( ) ) ,
2682+ ) ;
26792683 }
26802684 write_loading_content ( w, "</div>" ) ;
26812685 }
@@ -2700,17 +2704,12 @@ fn item_trait(w: &mut Buffer, cx: &Context, it: &clean::Item, t: &clean::Trait)
27002704 write_loading_content ( w, "</div>" ) ;
27012705 }
27022706 }
2703- write ! (
2704- w,
2705- r#"<script type="text/javascript">window.inlined_types=new Set({});</script>"# ,
2706- serde_json:: to_string( & synthetic_types) . unwrap( ) ,
2707- ) ;
27082707
27092708 write ! (
27102709 w,
2711- r# "<script type="text/javascript" async
2712- src="{root_path}/implementors/{path}/{ty}.{name}.js">
2713- </script>"# ,
2710+ "<script type=\ " text/javascript\" \
2711+ src=\ " {root_path}/implementors/{path}/{ty}.{name}.js\" async> \
2712+ </script>",
27142713 root_path = vec![ ".." ; cx. current. len( ) ] . join( "/" ) ,
27152714 path = if it. def_id. is_local( ) {
27162715 cx. current. join( "/" )
@@ -3392,6 +3391,7 @@ fn render_assoc_items(
33923391 None ,
33933392 false ,
33943393 true ,
3394+ & [ ] ,
33953395 ) ;
33963396 }
33973397 }
@@ -3602,6 +3602,9 @@ fn render_impl(
36023602 use_absolute : Option < bool > ,
36033603 is_on_foreign_type : bool ,
36043604 show_default_items : bool ,
3605+ // This argument is used to reference same type with different pathes to avoid duplication
3606+ // in documentation pages for trait with automatic implementations like "Send" and "Sync".
3607+ aliases : & [ String ] ,
36053608) {
36063609 if render_mode == RenderMode :: Normal {
36073610 let id = cx. derive_id ( match i. inner_impl ( ) . trait_ {
@@ -3614,8 +3617,13 @@ fn render_impl(
36143617 }
36153618 None => "impl" . to_string ( ) ,
36163619 } ) ;
3620+ let aliases = if aliases. is_empty ( ) {
3621+ String :: new ( )
3622+ } else {
3623+ format ! ( " aliases=\" {}\" " , aliases. join( "," ) )
3624+ } ;
36173625 if let Some ( use_absolute) = use_absolute {
3618- write ! ( w, "<h3 id='{}' class='impl'><code class='in-band'>" , id) ;
3626+ write ! ( w, "<h3 id='{}' class='impl'{} ><code class='in-band'>" , id, aliases ) ;
36193627 fmt_impl_for_trait_page ( & i. inner_impl ( ) , w, use_absolute) ;
36203628 if show_def_docs {
36213629 for it in & i. inner_impl ( ) . items {
@@ -3637,8 +3645,9 @@ fn render_impl(
36373645 } else {
36383646 write ! (
36393647 w,
3640- "<h3 id='{}' class='impl'><code class='in-band'>{}</code>" ,
3648+ "<h3 id='{}' class='impl'{} ><code class='in-band'>{}</code>" ,
36413649 id,
3650+ aliases,
36423651 i. inner_impl( ) . print( )
36433652 ) ;
36443653 }
0 commit comments