@@ -461,13 +461,7 @@ fn clean_projection<'tcx>(
461461 def_id : Option < DefId > ,
462462) -> Type {
463463 if cx. tcx . is_impl_trait_in_trait ( ty. skip_binder ( ) . def_id ) {
464- let bounds = cx
465- . tcx
466- . explicit_item_bounds ( ty. skip_binder ( ) . def_id )
467- . iter_instantiated_copied ( cx. tcx , ty. skip_binder ( ) . args )
468- . map ( |( pred, _) | pred)
469- . collect :: < Vec < _ > > ( ) ;
470- return clean_middle_opaque_bounds ( cx, bounds) ;
464+ return clean_middle_opaque_bounds ( cx, ty. skip_binder ( ) . def_id , ty. skip_binder ( ) . args ) ;
471465 }
472466
473467 let trait_ = clean_trait_ref_with_constraints (
@@ -2243,13 +2237,7 @@ pub(crate) fn clean_middle_ty<'tcx>(
22432237 * cx. current_type_aliases . entry ( def_id) . or_insert ( 0 ) += 1 ;
22442238 // Grab the "TraitA + TraitB" from `impl TraitA + TraitB`,
22452239 // by looking up the bounds associated with the def_id.
2246- let bounds = cx
2247- . tcx
2248- . explicit_item_bounds ( def_id)
2249- . iter_instantiated_copied ( cx. tcx , args)
2250- . map ( |( bound, _) | bound)
2251- . collect :: < Vec < _ > > ( ) ;
2252- let ty = clean_middle_opaque_bounds ( cx, bounds) ;
2240+ let ty = clean_middle_opaque_bounds ( cx, def_id, args) ;
22532241 if let Some ( count) = cx. current_type_aliases . get_mut ( & def_id) {
22542242 * count -= 1 ;
22552243 if * count == 0 {
@@ -2272,12 +2260,20 @@ pub(crate) fn clean_middle_ty<'tcx>(
22722260
22732261fn clean_middle_opaque_bounds < ' tcx > (
22742262 cx : & mut DocContext < ' tcx > ,
2275- bounds : Vec < ty:: Clause < ' tcx > > ,
2263+ impl_trait_def_id : DefId ,
2264+ args : ty:: GenericArgsRef < ' tcx > ,
22762265) -> Type {
22772266 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+
22782274 let mut bounds = bounds
22792275 . iter ( )
2280- . filter_map ( |bound| {
2276+ . filter_map ( |( bound, _ ) | {
22812277 let bound_predicate = bound. kind ( ) ;
22822278 let trait_ref = match bound_predicate. skip_binder ( ) {
22832279 ty:: ClauseKind :: Trait ( tr) => bound_predicate. rebind ( tr. trait_ref ) ,
@@ -2296,7 +2292,7 @@ fn clean_middle_opaque_bounds<'tcx>(
22962292
22972293 let bindings: ThinVec < _ > = bounds
22982294 . iter ( )
2299- . filter_map ( |bound| {
2295+ . filter_map ( |( bound, _ ) | {
23002296 if let ty:: ClauseKind :: Projection ( proj) = bound. kind ( ) . skip_binder ( ) {
23012297 if proj. projection_term . trait_ref ( cx. tcx ) == trait_ref. skip_binder ( ) {
23022298 Some ( AssocItemConstraint {
@@ -2336,6 +2332,10 @@ fn clean_middle_opaque_bounds<'tcx>(
23362332 bounds. insert ( 0 , GenericBound :: sized ( cx) ) ;
23372333 }
23382334
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+
23392339 ImplTrait ( bounds)
23402340}
23412341
0 commit comments