@@ -620,6 +620,39 @@ fn sidebar_render_assoc_items(
620620 blanket_impl : Vec < & Impl > ,
621621 items : & mut Vec < LinkBlock < ' _ > > ,
622622) {
623+ let format_concrete_impls = |impls : Vec < & Impl > , id_map : & mut IdMap | {
624+ let mut links = FxHashSet :: default ( ) ;
625+
626+ let ( locals, externals) : ( Vec < ( Link < ' static > , bool ) > , Vec < ( Link < ' static > , bool ) > ) = impls
627+ . iter ( )
628+ . filter_map ( |it| {
629+ let trait_ = it. inner_impl ( ) . trait_ . as_ref ( ) ?;
630+
631+ let encoded = id_map. derive ( super :: get_id_for_impl ( cx. tcx ( ) , it. impl_item . item_id ) ) ;
632+
633+ let prefix = match it. inner_impl ( ) . polarity {
634+ ty:: ImplPolarity :: Positive | ty:: ImplPolarity :: Reservation => "" ,
635+ ty:: ImplPolarity :: Negative => "!" ,
636+ } ;
637+ let generated = Link :: new ( encoded, format ! ( "{prefix}{:#}" , trait_. print( cx) ) ) ;
638+ if links. insert ( generated. clone ( ) ) {
639+ Some ( ( generated, trait_. res . def_id ( ) . is_local ( ) ) )
640+ } else {
641+ None
642+ }
643+ } )
644+ . partition ( |elem| elem. 1 ) ;
645+
646+ let mut locals = locals. into_iter ( ) . map ( |elem| elem. 0 ) . collect :: < Vec < Link < ' static > > > ( ) ;
647+ locals. sort ( ) ;
648+
649+ let mut externals =
650+ externals. into_iter ( ) . map ( |elem| elem. 0 ) . collect :: < Vec < Link < ' static > > > ( ) ;
651+ externals. sort ( ) ;
652+
653+ ( locals, externals)
654+ } ;
655+
623656 let format_impls = |impls : Vec < & Impl > , id_map : & mut IdMap | {
624657 let mut links = FxHashSet :: default ( ) ;
625658
@@ -641,14 +674,19 @@ fn sidebar_render_assoc_items(
641674 ret
642675 } ;
643676
644- let concrete = format_impls ( concrete, id_map) ;
677+ let ( concrete_locals , concrete_externals ) = format_concrete_impls ( concrete, id_map) ;
645678 let synthetic = format_impls ( synthetic, id_map) ;
646679 let blanket = format_impls ( blanket_impl, id_map) ;
647680 items. extend ( [
648681 LinkBlock :: new (
649- Link :: new ( "trait-implementations" , "Trait Implementations" ) ,
682+ Link :: new ( "crate-trait-implementations" , "Crate Trait Implementations" ) ,
683+ "trait-implementation" ,
684+ concrete_locals,
685+ ) ,
686+ LinkBlock :: new (
687+ Link :: new ( "external-trait-implementations" , "External Trait Implementations" ) ,
650688 "trait-implementation" ,
651- concrete ,
689+ concrete_externals ,
652690 ) ,
653691 LinkBlock :: new (
654692 Link :: new ( "synthetic-implementations" , "Auto Trait Implementations" ) ,
0 commit comments