@@ -1693,12 +1693,13 @@ impl<'a, 'tcx> Clean<Generics> for (&'a ty::Generics,
16931693 & ' a & ' tcx ty:: GenericPredicates < ' tcx > ) {
16941694 fn clean ( & self , cx : & DocContext < ' _ > ) -> Generics {
16951695 use self :: WherePredicate as WP ;
1696+ use std:: collections:: BTreeMap ;
16961697
16971698 let ( gens, preds) = * self ;
16981699
16991700 // Don't populate `cx.impl_trait_bounds` before `clean`ning `where` clauses,
17001701 // 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 ( ) ;
17021703
17031704 // Bounds in the type_params and lifetimes fields are repeated in the
17041705 // predicates field (see rustc_typeck::collect::ty_generics), so remove
@@ -1777,16 +1778,14 @@ impl<'a, 'tcx> Clean<Generics> for (&'a ty::Generics,
17771778 } )
17781779 . collect :: < Vec < _ > > ( ) ;
17791780
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.
17821783 bounds. sort_by_key ( |b| if let GenericBound :: TraitBound ( ..) = b {
17831784 false
17841785 } else {
17851786 true
17861787 } ) ;
1787- }
17881788
1789- for ( param, mut bounds) in impl_trait {
17901789 if let crate :: core:: ImplTraitParam :: ParamIndex ( idx) = param {
17911790 if let Some ( proj) = impl_trait_proj. remove ( & idx) {
17921791 for ( trait_did, name, rhs) in proj {
0 commit comments