@@ -992,13 +992,11 @@ themePicker.onblur = handleThemeButtonsBlur;
992
992
writeln ! ( v, "{}" , * implementor) . unwrap ( ) ;
993
993
}
994
994
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
+ }",
1002
1000
) ;
1003
1001
v. push_str ( "})()" ) ;
1004
1002
cx. shared . fs . write ( & mydst, & v) ?;
@@ -2353,6 +2351,7 @@ fn render_implementor(
2353
2351
implementor : & Impl ,
2354
2352
w : & mut Buffer ,
2355
2353
implementor_dups : & FxHashMap < & str , ( DefId , bool ) > ,
2354
+ aliases : & [ String ] ,
2356
2355
) {
2357
2356
// If there's already another implementor that has the same abbridged name, use the
2358
2357
// full path, for example in `std::iter::ExactSizeIterator`
@@ -2375,6 +2374,7 @@ fn render_implementor(
2375
2374
Some ( use_absolute) ,
2376
2375
false ,
2377
2376
false ,
2377
+ aliases,
2378
2378
) ;
2379
2379
}
2380
2380
@@ -2396,6 +2396,7 @@ fn render_impls(cx: &Context, w: &mut Buffer, traits: &[&&Impl], containing_item
2396
2396
None ,
2397
2397
false ,
2398
2398
true ,
2399
+ & [ ] ,
2399
2400
) ;
2400
2401
buffer. into_inner ( )
2401
2402
} )
@@ -2597,8 +2598,6 @@ fn item_trait(w: &mut Buffer, cx: &Context, it: &clean::Item, t: &clean::Trait)
2597
2598
// If there are methods directly on this trait object, render them here.
2598
2599
render_assoc_items ( w, cx, it, it. def_id , AssocItemRender :: All ) ;
2599
2600
2600
- let mut synthetic_types = Vec :: new ( ) ;
2601
-
2602
2601
if let Some ( implementors) = cx. cache . implementors . get ( & it. def_id ) {
2603
2602
// The DefId is for the first Type found with that name. The bool is
2604
2603
// 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)
2649
2648
None ,
2650
2649
true ,
2651
2650
false ,
2651
+ & [ ] ,
2652
2652
) ;
2653
2653
}
2654
2654
write_loading_content ( w, "" ) ;
@@ -2661,7 +2661,7 @@ fn item_trait(w: &mut Buffer, cx: &Context, it: &clean::Item, t: &clean::Trait)
2661
2661
"<div class='item-list' id='implementors-list'>" ,
2662
2662
) ;
2663
2663
for implementor in concrete {
2664
- render_implementor ( cx, implementor, w, & implementor_dups) ;
2664
+ render_implementor ( cx, implementor, w, & implementor_dups, & [ ] ) ;
2665
2665
}
2666
2666
write_loading_content ( w, "</div>" ) ;
2667
2667
@@ -2673,9 +2673,13 @@ fn item_trait(w: &mut Buffer, cx: &Context, it: &clean::Item, t: &clean::Trait)
2673
2673
"<div class='item-list' id='synthetic-implementors-list'>" ,
2674
2674
) ;
2675
2675
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
+ ) ;
2679
2683
}
2680
2684
write_loading_content ( w, "</div>" ) ;
2681
2685
}
@@ -2700,17 +2704,12 @@ fn item_trait(w: &mut Buffer, cx: &Context, it: &clean::Item, t: &clean::Trait)
2700
2704
write_loading_content ( w, "</div>" ) ;
2701
2705
}
2702
2706
}
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
- ) ;
2708
2707
2709
2708
write ! (
2710
2709
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>",
2714
2713
root_path = vec![ ".." ; cx. current. len( ) ] . join( "/" ) ,
2715
2714
path = if it. def_id. is_local( ) {
2716
2715
cx. current. join( "/" )
@@ -3392,6 +3391,7 @@ fn render_assoc_items(
3392
3391
None ,
3393
3392
false ,
3394
3393
true ,
3394
+ & [ ] ,
3395
3395
) ;
3396
3396
}
3397
3397
}
@@ -3602,6 +3602,9 @@ fn render_impl(
3602
3602
use_absolute : Option < bool > ,
3603
3603
is_on_foreign_type : bool ,
3604
3604
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 ] ,
3605
3608
) {
3606
3609
if render_mode == RenderMode :: Normal {
3607
3610
let id = cx. derive_id ( match i. inner_impl ( ) . trait_ {
@@ -3614,8 +3617,13 @@ fn render_impl(
3614
3617
}
3615
3618
None => "impl" . to_string ( ) ,
3616
3619
} ) ;
3620
+ let aliases = if aliases. is_empty ( ) {
3621
+ String :: new ( )
3622
+ } else {
3623
+ format ! ( " aliases=\" {}\" " , aliases. join( "," ) )
3624
+ } ;
3617
3625
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 ) ;
3619
3627
fmt_impl_for_trait_page ( & i. inner_impl ( ) , w, use_absolute) ;
3620
3628
if show_def_docs {
3621
3629
for it in & i. inner_impl ( ) . items {
@@ -3637,8 +3645,9 @@ fn render_impl(
3637
3645
} else {
3638
3646
write ! (
3639
3647
w,
3640
- "<h3 id='{}' class='impl'><code class='in-band'>{}</code>" ,
3648
+ "<h3 id='{}' class='impl'{} ><code class='in-band'>{}</code>" ,
3641
3649
id,
3650
+ aliases,
3642
3651
i. inner_impl( ) . print( )
3643
3652
) ;
3644
3653
}
0 commit comments