@@ -716,11 +716,11 @@ impl<'a, 'tcx> Clean<Generics> for (&'a ty::Generics, ty::GenericPredicates<'tcx
716
716
// Bounds in the type_params and lifetimes fields are repeated in the
717
717
// predicates field (see rustc_typeck::collect::ty_generics), so remove
718
718
// them.
719
- let stripped_typarams = gens
719
+ let stripped_params = gens
720
720
. params
721
721
. iter ( )
722
722
. filter_map ( |param| match param. kind {
723
- ty:: GenericParamDefKind :: Lifetime => None ,
723
+ ty:: GenericParamDefKind :: Lifetime => Some ( param . clean ( cx ) ) ,
724
724
ty:: GenericParamDefKind :: Type { synthetic, .. } => {
725
725
if param. name == kw:: SelfUpper {
726
726
assert_eq ! ( param. index, 0 ) ;
@@ -732,7 +732,7 @@ impl<'a, 'tcx> Clean<Generics> for (&'a ty::Generics, ty::GenericPredicates<'tcx
732
732
}
733
733
Some ( param. clean ( cx) )
734
734
}
735
- ty:: GenericParamDefKind :: Const { .. } => None ,
735
+ ty:: GenericParamDefKind :: Const { .. } => Some ( param . clean ( cx ) ) ,
736
736
} )
737
737
. collect :: < Vec < GenericParamDef > > ( ) ;
738
738
@@ -844,8 +844,10 @@ impl<'a, 'tcx> Clean<Generics> for (&'a ty::Generics, ty::GenericPredicates<'tcx
844
844
845
845
// Run through the type parameters again and insert a ?Sized
846
846
// 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
+ {
849
851
where_predicates. push ( WP :: BoundPredicate {
850
852
ty : Type :: Generic ( tp. name . clone ( ) ) ,
851
853
bounds : vec ! [ GenericBound :: maybe_sized( cx) ] ,
@@ -858,16 +860,7 @@ impl<'a, 'tcx> Clean<Generics> for (&'a ty::Generics, ty::GenericPredicates<'tcx
858
860
// and instead see `where T: Foo + Bar + Sized + 'a`
859
861
860
862
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,
871
864
where_predicates : simplify:: where_clauses ( cx, where_predicates) ,
872
865
}
873
866
}
0 commit comments