@@ -138,36 +138,37 @@ impl Clean<Path> for ty::TraitRef<'tcx> {
138138 }
139139}
140140
141- impl Clean < GenericBound > for ( ty:: PolyTraitRef < ' _ > , & [ TypeBinding ] ) {
142- fn clean ( & self , cx : & mut DocContext < ' _ > ) -> GenericBound {
143- let ( poly_trait_ref, bindings) = * self ;
144- let poly_trait_ref = poly_trait_ref. lift_to_tcx ( cx. tcx ) . unwrap ( ) ;
145-
146- // collect any late bound regions
147- let late_bound_regions: Vec < _ > = cx
148- . tcx
149- . collect_referenced_late_bound_regions ( & poly_trait_ref)
150- . into_iter ( )
151- . filter_map ( |br| match br {
152- ty:: BrNamed ( _, name) => Some ( GenericParamDef {
153- name,
154- kind : GenericParamDefKind :: Lifetime { outlives : vec ! [ ] } ,
155- } ) ,
156- _ => None ,
157- } )
158- . collect ( ) ;
141+ fn clean_poly_trait_ref_with_bindings (
142+ cx : & mut DocContext < ' _ > ,
143+ poly_trait_ref : ty:: PolyTraitRef < ' _ > ,
144+ bindings : & [ TypeBinding ] ,
145+ ) -> GenericBound {
146+ let poly_trait_ref = poly_trait_ref. lift_to_tcx ( cx. tcx ) . unwrap ( ) ;
147+
148+ // collect any late bound regions
149+ let late_bound_regions: Vec < _ > = cx
150+ . tcx
151+ . collect_referenced_late_bound_regions ( & poly_trait_ref)
152+ . into_iter ( )
153+ . filter_map ( |br| match br {
154+ ty:: BrNamed ( _, name) => Some ( GenericParamDef {
155+ name,
156+ kind : GenericParamDefKind :: Lifetime { outlives : vec ! [ ] } ,
157+ } ) ,
158+ _ => None ,
159+ } )
160+ . collect ( ) ;
159161
160- let trait_ = clean_trait_ref_with_bindings ( cx, poly_trait_ref. skip_binder ( ) , bindings) ;
161- GenericBound :: TraitBound (
162- PolyTrait { trait_, generic_params : late_bound_regions } ,
163- hir:: TraitBoundModifier :: None ,
164- )
165- }
162+ let trait_ = clean_trait_ref_with_bindings ( cx, poly_trait_ref. skip_binder ( ) , bindings) ;
163+ GenericBound :: TraitBound (
164+ PolyTrait { trait_, generic_params : late_bound_regions } ,
165+ hir:: TraitBoundModifier :: None ,
166+ )
166167}
167168
168169impl < ' tcx > Clean < GenericBound > for ty:: PolyTraitRef < ' tcx > {
169170 fn clean ( & self , cx : & mut DocContext < ' _ > ) -> GenericBound {
170- ( * self , & [ ] [ .. ] ) . clean ( cx )
171+ clean_poly_trait_ref_with_bindings ( cx , * self , & [ ] )
171172 }
172173}
173174
@@ -1513,7 +1514,7 @@ impl<'tcx> Clean<Type> for Ty<'tcx> {
15131514 }
15141515 }
15151516
1516- let bounds : Vec < _ > = bounds
1517+ let bindings : Vec < _ > = bounds
15171518 . iter ( )
15181519 . filter_map ( |bound| {
15191520 if let ty:: PredicateKind :: Projection ( proj) =
@@ -1541,7 +1542,7 @@ impl<'tcx> Clean<Type> for Ty<'tcx> {
15411542 } )
15421543 . collect ( ) ;
15431544
1544- Some ( ( trait_ref, & bounds [ .. ] ) . clean ( cx ) )
1545+ Some ( clean_poly_trait_ref_with_bindings ( cx , trait_ref, & bindings ) )
15451546 } )
15461547 . collect :: < Vec < _ > > ( ) ;
15471548 bounds. extend ( regions) ;
0 commit comments