@@ -228,8 +228,9 @@ fn clean_generic_bound<'tcx>(
228228
229229 GenericBound :: TraitBound ( clean_poly_trait_ref ( t, cx) , modifier)
230230 }
231- // FIXME(precise_capturing): Implement rustdoc support
232- hir:: GenericBound :: Use ( ..) => return None ,
231+ hir:: GenericBound :: Use ( args, ..) => {
232+ GenericBound :: Use ( args. iter ( ) . map ( |arg| arg. name ( ) ) . collect ( ) )
233+ }
233234 } )
234235}
235236
@@ -460,13 +461,7 @@ fn clean_projection<'tcx>(
460461 def_id : Option < DefId > ,
461462) -> Type {
462463 if cx. tcx . is_impl_trait_in_trait ( ty. skip_binder ( ) . def_id ) {
463- let bounds = cx
464- . tcx
465- . explicit_item_bounds ( ty. skip_binder ( ) . def_id )
466- . iter_instantiated_copied ( cx. tcx , ty. skip_binder ( ) . args )
467- . map ( |( pred, _) | pred)
468- . collect :: < Vec < _ > > ( ) ;
469- return clean_middle_opaque_bounds ( cx, bounds) ;
464+ return clean_middle_opaque_bounds ( cx, ty. skip_binder ( ) . def_id , ty. skip_binder ( ) . args ) ;
470465 }
471466
472467 let trait_ = clean_trait_ref_with_constraints (
@@ -2242,13 +2237,7 @@ pub(crate) fn clean_middle_ty<'tcx>(
22422237 * cx. current_type_aliases . entry ( def_id) . or_insert ( 0 ) += 1 ;
22432238 // Grab the "TraitA + TraitB" from `impl TraitA + TraitB`,
22442239 // by looking up the bounds associated with the def_id.
2245- let bounds = cx
2246- . tcx
2247- . explicit_item_bounds ( def_id)
2248- . iter_instantiated_copied ( cx. tcx , args)
2249- . map ( |( bound, _) | bound)
2250- . collect :: < Vec < _ > > ( ) ;
2251- let ty = clean_middle_opaque_bounds ( cx, bounds) ;
2240+ let ty = clean_middle_opaque_bounds ( cx, def_id, args) ;
22522241 if let Some ( count) = cx. current_type_aliases . get_mut ( & def_id) {
22532242 * count -= 1 ;
22542243 if * count == 0 {
@@ -2271,12 +2260,20 @@ pub(crate) fn clean_middle_ty<'tcx>(
22712260
22722261fn clean_middle_opaque_bounds < ' tcx > (
22732262 cx : & mut DocContext < ' tcx > ,
2274- bounds : Vec < ty:: Clause < ' tcx > > ,
2263+ impl_trait_def_id : DefId ,
2264+ args : ty:: GenericArgsRef < ' tcx > ,
22752265) -> Type {
22762266 let mut has_sized = false ;
2267+
2268+ let bounds: Vec < _ > = cx
2269+ . tcx
2270+ . explicit_item_bounds ( impl_trait_def_id)
2271+ . iter_instantiated_copied ( cx. tcx , args)
2272+ . collect ( ) ;
2273+
22772274 let mut bounds = bounds
22782275 . iter ( )
2279- . filter_map ( |bound| {
2276+ . filter_map ( |( bound, _ ) | {
22802277 let bound_predicate = bound. kind ( ) ;
22812278 let trait_ref = match bound_predicate. skip_binder ( ) {
22822279 ty:: ClauseKind :: Trait ( tr) => bound_predicate. rebind ( tr. trait_ref ) ,
@@ -2295,7 +2292,7 @@ fn clean_middle_opaque_bounds<'tcx>(
22952292
22962293 let bindings: ThinVec < _ > = bounds
22972294 . iter ( )
2298- . filter_map ( |bound| {
2295+ . filter_map ( |( bound, _ ) | {
22992296 if let ty:: ClauseKind :: Projection ( proj) = bound. kind ( ) . skip_binder ( ) {
23002297 if proj. projection_term . trait_ref ( cx. tcx ) == trait_ref. skip_binder ( ) {
23012298 Some ( AssocItemConstraint {
@@ -2335,6 +2332,10 @@ fn clean_middle_opaque_bounds<'tcx>(
23352332 bounds. insert ( 0 , GenericBound :: sized ( cx) ) ;
23362333 }
23372334
2335+ if let Some ( args) = cx. tcx . rendered_precise_capturing_args ( impl_trait_def_id) {
2336+ bounds. push ( GenericBound :: Use ( args. to_vec ( ) ) ) ;
2337+ }
2338+
23382339 ImplTrait ( bounds)
23392340}
23402341
0 commit comments