@@ -1693,12 +1693,13 @@ impl<'a, 'tcx> Clean<Generics> for (&'a ty::Generics,
1693
1693
& ' a & ' tcx ty:: GenericPredicates < ' tcx > ) {
1694
1694
fn clean ( & self , cx : & DocContext < ' _ > ) -> Generics {
1695
1695
use self :: WherePredicate as WP ;
1696
+ use std:: collections:: BTreeMap ;
1696
1697
1697
1698
let ( gens, preds) = * self ;
1698
1699
1699
1700
// Don't populate `cx.impl_trait_bounds` before `clean`ning `where` clauses,
1700
1701
// since `Clean for ty::Predicate` would consume them.
1701
- let mut impl_trait = FxHashMap :: < ImplTraitParam , Vec < GenericBound > > :: default ( ) ;
1702
+ let mut impl_trait = BTreeMap :: < ImplTraitParam , Vec < GenericBound > > :: default ( ) ;
1702
1703
1703
1704
// Bounds in the type_params and lifetimes fields are repeated in the
1704
1705
// predicates field (see rustc_typeck::collect::ty_generics), so remove
@@ -1777,16 +1778,14 @@ impl<'a, 'tcx> Clean<Generics> for (&'a ty::Generics,
1777
1778
} )
1778
1779
. collect :: < Vec < _ > > ( ) ;
1779
1780
1780
- // Move `TraitPredicate`s to the front.
1781
- for ( _ , bounds) in impl_trait . iter_mut ( ) {
1781
+ for ( param , mut bounds ) in impl_trait {
1782
+ // Move trait bounds to the front.
1782
1783
bounds. sort_by_key ( |b| if let GenericBound :: TraitBound ( ..) = b {
1783
1784
false
1784
1785
} else {
1785
1786
true
1786
1787
} ) ;
1787
- }
1788
1788
1789
- for ( param, mut bounds) in impl_trait {
1790
1789
if let crate :: core:: ImplTraitParam :: ParamIndex ( idx) = param {
1791
1790
if let Some ( proj) = impl_trait_proj. remove ( & idx) {
1792
1791
for ( trait_did, name, rhs) in proj {
0 commit comments