@@ -1725,7 +1725,7 @@ impl<'a, 'tcx> Clean<Generics> for (&'a ty::Generics,
17251725 let mut impl_trait_proj =
17261726 FxHashMap :: < u32 , Vec < ( DefId , String , Ty < ' tcx > ) > > :: default ( ) ;
17271727
1728- let mut where_predicates = preds. predicates . iter ( )
1728+ let where_predicates = preds. predicates . iter ( )
17291729 . flat_map ( |( p, _) | {
17301730 let mut projection = None ;
17311731 let param_idx = ( || {
@@ -1747,10 +1747,10 @@ impl<'a, 'tcx> Clean<Generics> for (&'a ty::Generics,
17471747 None
17481748 } ) ( ) ;
17491749
1750- let p = p. clean ( cx) ?;
1751-
17521750 if let Some ( param_idx) = param_idx {
17531751 if let Some ( b) = impl_trait. get_mut ( & param_idx. into ( ) ) {
1752+ let p = p. clean ( cx) ?;
1753+
17541754 b. extend (
17551755 p. get_bounds ( )
17561756 . into_iter ( )
@@ -1805,6 +1805,13 @@ impl<'a, 'tcx> Clean<Generics> for (&'a ty::Generics,
18051805 cx. impl_trait_bounds . borrow_mut ( ) . insert ( param, bounds) ;
18061806 }
18071807
1808+ // Now that `cx.impl_trait_bounds` is populated, we can process
1809+ // remaining predicates which could contain `impl Trait`.
1810+ let mut where_predicates = where_predicates
1811+ . into_iter ( )
1812+ . flat_map ( |p| p. clean ( cx) )
1813+ . collect :: < Vec < _ > > ( ) ;
1814+
18081815 // Type parameters and have a Sized bound by default unless removed with
18091816 // ?Sized. Scan through the predicates and mark any type parameter with
18101817 // a Sized bound, removing the bounds as we find them.
0 commit comments