@@ -716,11 +716,11 @@ impl<'a, 'tcx> Clean<Generics> for (&'a ty::Generics, ty::GenericPredicates<'tcx
716716 // Bounds in the type_params and lifetimes fields are repeated in the
717717 // predicates field (see rustc_typeck::collect::ty_generics), so remove
718718 // them.
719- let stripped_typarams = gens
719+ let stripped_params = gens
720720 . params
721721 . iter ( )
722722 . filter_map ( |param| match param. kind {
723- ty:: GenericParamDefKind :: Lifetime => None ,
723+ ty:: GenericParamDefKind :: Lifetime => Some ( param . clean ( cx ) ) ,
724724 ty:: GenericParamDefKind :: Type { synthetic, .. } => {
725725 if param. name == kw:: SelfUpper {
726726 assert_eq ! ( param. index, 0 ) ;
@@ -732,7 +732,7 @@ impl<'a, 'tcx> Clean<Generics> for (&'a ty::Generics, ty::GenericPredicates<'tcx
732732 }
733733 Some ( param. clean ( cx) )
734734 }
735- ty:: GenericParamDefKind :: Const { .. } => None ,
735+ ty:: GenericParamDefKind :: Const { .. } => Some ( param . clean ( cx ) ) ,
736736 } )
737737 . collect :: < Vec < GenericParamDef > > ( ) ;
738738
@@ -844,8 +844,10 @@ impl<'a, 'tcx> Clean<Generics> for (&'a ty::Generics, ty::GenericPredicates<'tcx
844844
845845 // Run through the type parameters again and insert a ?Sized
846846 // unbound for any we didn't find to be Sized.
847- for tp in & stripped_typarams {
848- if !sized_params. contains ( & tp. name ) {
847+ for tp in & stripped_params {
848+ if matches ! ( tp. kind, types:: GenericParamDefKind :: Type { .. } )
849+ && !sized_params. contains ( & tp. name )
850+ {
849851 where_predicates. push ( WP :: BoundPredicate {
850852 ty : Type :: Generic ( tp. name . clone ( ) ) ,
851853 bounds : vec ! [ GenericBound :: maybe_sized( cx) ] ,
@@ -858,16 +860,7 @@ impl<'a, 'tcx> Clean<Generics> for (&'a ty::Generics, ty::GenericPredicates<'tcx
858860 // and instead see `where T: Foo + Bar + Sized + 'a`
859861
860862 Generics {
861- params : gens
862- . params
863- . iter ( )
864- . flat_map ( |param| match param. kind {
865- ty:: GenericParamDefKind :: Lifetime => Some ( param. clean ( cx) ) ,
866- ty:: GenericParamDefKind :: Type { .. } => None ,
867- ty:: GenericParamDefKind :: Const { .. } => Some ( param. clean ( cx) ) ,
868- } )
869- . chain ( simplify:: ty_params ( stripped_typarams) . into_iter ( ) )
870- . collect ( ) ,
863+ params : stripped_params,
871864 where_predicates : simplify:: where_clauses ( cx, where_predicates) ,
872865 }
873866 }
0 commit comments