@@ -664,18 +664,18 @@ fn item_trait(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, t: &clean::Tra
664
664
}
665
665
}
666
666
667
- let ( local, foreign) = implementors. iter ( ) . partition :: < Vec < _ > , _ > ( |i| {
667
+ let ( mut local, mut foreign) = implementors. iter ( ) . partition :: < Vec < _ > , _ > ( |i| {
668
668
i. inner_impl ( )
669
669
. for_
670
670
. def_id_full ( cx. cache ( ) )
671
671
. map_or ( true , |d| cx. cache . paths . contains_key ( & d) )
672
672
} ) ;
673
673
674
- let ( mut synthetic , mut concrete ) : ( Vec < & & Impl > , Vec < & & Impl > ) =
675
- local . iter ( ) . partition ( |i| i . inner_impl ( ) . synthetic ) ;
674
+ local . sort_by ( |a , b| compare_impl ( a , b , cx ) ) ;
675
+ foreign . sort_by ( |a , b| compare_impl ( a , b , cx ) ) ;
676
676
677
- synthetic . sort_by ( |a , b| compare_impl ( a , b , cx ) ) ;
678
- concrete . sort_by ( |a , b| compare_impl ( a , b , cx ) ) ;
677
+ let ( synthetic , concrete ) : ( Vec < & & Impl > , Vec < & & Impl > ) =
678
+ local . iter ( ) . partition ( |i| i . inner_impl ( ) . synthetic ) ;
679
679
680
680
if !foreign. is_empty ( ) {
681
681
write_small_section_header ( w, "foreign-impls" , "Implementations on Foreign Types" , "" ) ;
@@ -1284,10 +1284,16 @@ fn render_stability_since(
1284
1284
)
1285
1285
}
1286
1286
1287
- fn compare_impl < ' a , ' b > ( lhs : & ' a & & Impl , rhs : & ' b & & Impl , cx : & Context < ' _ > ) -> Ordering {
1287
+ fn compare_impl < ' a , ' b > ( lhs : & ' a & Impl , rhs : & ' b & Impl , cx : & Context < ' _ > ) -> Ordering {
1288
1288
let lhss = format ! ( "{}" , lhs. inner_impl( ) . print( false , cx) ) ;
1289
1289
let rhss = format ! ( "{}" , rhs. inner_impl( ) . print( false , cx) ) ;
1290
1290
1291
+ if lhs. inner_impl ( ) . negative_polarity && !rhs. inner_impl ( ) . negative_polarity {
1292
+ return Ordering :: Less ;
1293
+ } else if rhs. inner_impl ( ) . negative_polarity && !lhs. inner_impl ( ) . negative_polarity {
1294
+ return Ordering :: Greater ;
1295
+ }
1296
+
1291
1297
// lhs and rhs are formatted as HTML, which may be unnecessary
1292
1298
compare_names ( & lhss, & rhss)
1293
1299
}
0 commit comments