@@ -1379,17 +1379,18 @@ fn external_path(cx: &DocContext, name: &str, trait_did: Option<DefId>, has_self
13791379 }
13801380}
13811381
1382- impl < ' tcx > Clean < TyParamBound > for ty:: TraitRef < ' tcx > {
1382+ impl < ' a , ' tcx > Clean < TyParamBound > for ( & ' a ty:: TraitRef < ' tcx > , Vec < TypeBinding > ) {
13831383 fn clean ( & self , cx : & DocContext ) -> TyParamBound {
1384- inline:: record_extern_fqn ( cx, self . def_id , TypeKind :: Trait ) ;
1385- let path = external_path ( cx, & cx. tcx . item_name ( self . def_id ) ,
1386- Some ( self . def_id ) , true , vec ! [ ] , self . substs ) ;
1384+ let ( trait_ref, ref bounds) = * self ;
1385+ inline:: record_extern_fqn ( cx, trait_ref. def_id , TypeKind :: Trait ) ;
1386+ let path = external_path ( cx, & cx. tcx . item_name ( trait_ref. def_id ) ,
1387+ Some ( trait_ref. def_id ) , true , bounds. clone ( ) , trait_ref. substs ) ;
13871388
1388- debug ! ( "ty::TraitRef\n subst: {:?}\n " , self . substs) ;
1389+ debug ! ( "ty::TraitRef\n subst: {:?}\n " , trait_ref . substs) ;
13891390
13901391 // collect any late bound regions
13911392 let mut late_bounds = vec ! [ ] ;
1392- for ty_s in self . input_types ( ) . skip ( 1 ) {
1393+ for ty_s in trait_ref . input_types ( ) . skip ( 1 ) {
13931394 if let ty:: TyTuple ( ts) = ty_s. sty {
13941395 for & ty_s in ts {
13951396 if let ty:: TyRef ( ref reg, _) = ty_s. sty {
@@ -1409,7 +1410,7 @@ impl<'tcx> Clean<TyParamBound> for ty::TraitRef<'tcx> {
14091410 trait_ : ResolvedPath {
14101411 path,
14111412 typarams : None ,
1412- did : self . def_id ,
1413+ did : trait_ref . def_id ,
14131414 is_generic : false ,
14141415 } ,
14151416 generic_params : late_bounds,
@@ -1419,6 +1420,12 @@ impl<'tcx> Clean<TyParamBound> for ty::TraitRef<'tcx> {
14191420 }
14201421}
14211422
1423+ impl < ' tcx > Clean < TyParamBound > for ty:: TraitRef < ' tcx > {
1424+ fn clean ( & self , cx : & DocContext ) -> TyParamBound {
1425+ ( self , vec ! [ ] ) . clean ( cx)
1426+ }
1427+ }
1428+
14221429impl < ' tcx > Clean < Option < Vec < TyParamBound > > > for Substs < ' tcx > {
14231430 fn clean ( & self , cx : & DocContext ) -> Option < Vec < TyParamBound > > {
14241431 let mut v = Vec :: new ( ) ;
@@ -2757,7 +2764,30 @@ impl<'tcx> Clean<Type> for Ty<'tcx> {
27572764 let substs = cx. tcx . lift ( & substs) . unwrap ( ) ;
27582765 let bounds = predicates_of. instantiate ( cx. tcx , substs) ;
27592766 ImplTrait ( bounds. predicates . iter ( ) . filter_map ( |predicate| {
2760- predicate. to_opt_poly_trait_ref ( ) . clean ( cx)
2767+ let trait_ref = if let Some ( tr) = predicate. to_opt_poly_trait_ref ( ) {
2768+ tr
2769+ } else {
2770+ return None ;
2771+ } ;
2772+
2773+ let bounds = bounds. predicates . iter ( ) . filter_map ( |pred|
2774+ if let ty:: Predicate :: Projection ( proj) = * pred {
2775+ let proj = proj. skip_binder ( ) ;
2776+ if proj. projection_ty . trait_ref ( cx. tcx ) == * trait_ref. skip_binder ( ) {
2777+ Some ( TypeBinding {
2778+ name : cx. tcx . associated_item ( proj. projection_ty . item_def_id )
2779+ . name . clean ( cx) ,
2780+ ty : proj. ty . clean ( cx) ,
2781+ } )
2782+ } else {
2783+ None
2784+ }
2785+ } else {
2786+ None
2787+ }
2788+ ) . collect ( ) ;
2789+
2790+ Some ( ( trait_ref. skip_binder ( ) , bounds) . clean ( cx) )
27612791 } ) . collect ( ) )
27622792 }
27632793
0 commit comments