@@ -504,22 +504,28 @@ impl Clean<TyParamBound> for ast::TyParamBound {
504504 }
505505}
506506
507- impl < ' tcx > Clean < Vec < TyParamBound > > for ty:: ExistentialBounds < ' tcx > {
508- fn clean ( & self , cx : & DocContext ) -> Vec < TyParamBound > {
509- let mut vec = vec ! [ ] ;
510- self . region_bound . clean ( cx) . map ( |b| vec . push ( RegionBound ( b) ) ) ;
507+ impl < ' tcx > Clean < ( Vec < TyParamBound > , Vec < TypeBinding > ) > for ty:: ExistentialBounds < ' tcx > {
508+ fn clean ( & self , cx : & DocContext ) -> ( Vec < TyParamBound > , Vec < TypeBinding > ) {
509+ let mut tp_bounds = vec ! [ ] ;
510+ self . region_bound . clean ( cx) . map ( |b| tp_bounds . push ( RegionBound ( b) ) ) ;
511511 for bb in self . builtin_bounds . iter ( ) {
512- vec . push ( bb. clean ( cx) ) ;
512+ tp_bounds . push ( bb. clean ( cx) ) ;
513513 }
514514
515- // FIXME(#20299) -- should do something with projection bounds
515+ let mut bindings = vec ! [ ] ;
516+ for & ty:: Binder ( ref pb) in self . projection_bounds . iter ( ) {
517+ bindings. push ( TypeBinding {
518+ name : pb. projection_ty . item_name . clean ( cx) ,
519+ ty : pb. ty . clean ( cx)
520+ } ) ;
521+ }
516522
517- vec
523+ ( tp_bounds , bindings )
518524 }
519525}
520526
521527fn external_path_params ( cx : & DocContext , trait_did : Option < ast:: DefId > ,
522- substs : & subst:: Substs ) -> PathParameters {
528+ bindings : Vec < TypeBinding > , substs : & subst:: Substs ) -> PathParameters {
523529 use rustc:: middle:: ty:: sty;
524530 let lifetimes = substs. regions ( ) . get_slice ( subst:: TypeSpace )
525531 . iter ( )
@@ -537,7 +543,7 @@ fn external_path_params(cx: &DocContext, trait_did: Option<ast::DefId>,
537543 return PathParameters :: AngleBracketed {
538544 lifetimes : lifetimes,
539545 types : types. clean ( cx) ,
540- bindings : vec ! [ ]
546+ bindings : bindings
541547 }
542548 }
543549 } ;
@@ -554,7 +560,7 @@ fn external_path_params(cx: &DocContext, trait_did: Option<ast::DefId>,
554560 PathParameters :: AngleBracketed {
555561 lifetimes : lifetimes,
556562 types : types. clean ( cx) ,
557- bindings : vec ! [ ] // FIXME(#20646)
563+ bindings : bindings
558564 }
559565 }
560566 }
@@ -563,12 +569,12 @@ fn external_path_params(cx: &DocContext, trait_did: Option<ast::DefId>,
563569// trait_did should be set to a trait's DefId if called on a TraitRef, in order to sugar
564570// from Fn<(A, B,), C> to Fn(A, B) -> C
565571fn external_path ( cx : & DocContext , name : & str , trait_did : Option < ast:: DefId > ,
566- substs : & subst:: Substs ) -> Path {
572+ bindings : Vec < TypeBinding > , substs : & subst:: Substs ) -> Path {
567573 Path {
568574 global : false ,
569575 segments : vec ! [ PathSegment {
570576 name: name. to_string( ) ,
571- params: external_path_params( cx, trait_did, substs)
577+ params: external_path_params( cx, trait_did, bindings , substs)
572578 } ] ,
573579 }
574580}
@@ -583,16 +589,16 @@ impl Clean<TyParamBound> for ty::BuiltinBound {
583589 let ( did, path) = match * self {
584590 ty:: BoundSend =>
585591 ( tcx. lang_items . send_trait ( ) . unwrap ( ) ,
586- external_path ( cx, "Send" , None , & empty) ) ,
592+ external_path ( cx, "Send" , None , vec ! [ ] , & empty) ) ,
587593 ty:: BoundSized =>
588594 ( tcx. lang_items . sized_trait ( ) . unwrap ( ) ,
589- external_path ( cx, "Sized" , None , & empty) ) ,
595+ external_path ( cx, "Sized" , None , vec ! [ ] , & empty) ) ,
590596 ty:: BoundCopy =>
591597 ( tcx. lang_items . copy_trait ( ) . unwrap ( ) ,
592- external_path ( cx, "Copy" , None , & empty) ) ,
598+ external_path ( cx, "Copy" , None , vec ! [ ] , & empty) ) ,
593599 ty:: BoundSync =>
594600 ( tcx. lang_items . sync_trait ( ) . unwrap ( ) ,
595- external_path ( cx, "Sync" , None , & empty) ) ,
601+ external_path ( cx, "Sync" , None , vec ! [ ] , & empty) ) ,
596602 } ;
597603 let fqn = csearch:: get_item_path ( tcx, did) ;
598604 let fqn = fqn. into_iter ( ) . map ( |i| i. to_string ( ) ) . collect ( ) ;
@@ -619,7 +625,7 @@ impl<'tcx> Clean<TyParamBound> for ty::TraitRef<'tcx> {
619625 let fqn = fqn. into_iter ( ) . map ( |i| i. to_string ( ) )
620626 . collect :: < Vec < String > > ( ) ;
621627 let path = external_path ( cx, fqn. last ( ) . unwrap ( ) . as_slice ( ) ,
622- Some ( self . def_id ) , self . substs ) ;
628+ Some ( self . def_id ) , vec ! [ ] , self . substs ) ;
623629 cx. external_paths . borrow_mut ( ) . as_mut ( ) . unwrap ( ) . insert ( self . def_id ,
624630 ( fqn, TypeTrait ) ) ;
625631
@@ -1558,7 +1564,7 @@ impl<'tcx> Clean<Type> for ty::Ty<'tcx> {
15581564 _ => TypeEnum ,
15591565 } ;
15601566 let path = external_path ( cx, fqn. last ( ) . unwrap ( ) . to_string ( ) . as_slice ( ) ,
1561- None , substs) ;
1567+ None , vec ! [ ] , substs) ;
15621568 cx. external_paths . borrow_mut ( ) . as_mut ( ) . unwrap ( ) . insert ( did, ( fqn, kind) ) ;
15631569 ResolvedPath {
15641570 path : path,
@@ -1570,12 +1576,13 @@ impl<'tcx> Clean<Type> for ty::Ty<'tcx> {
15701576 let did = principal. def_id ( ) ;
15711577 let fqn = csearch:: get_item_path ( cx. tcx ( ) , did) ;
15721578 let fqn: Vec < _ > = fqn. into_iter ( ) . map ( |i| i. to_string ( ) ) . collect ( ) ;
1579+ let ( typarams, bindings) = bounds. clean ( cx) ;
15731580 let path = external_path ( cx, fqn. last ( ) . unwrap ( ) . to_string ( ) . as_slice ( ) ,
1574- Some ( did) , principal. substs ( ) ) ;
1581+ Some ( did) , bindings , principal. substs ( ) ) ;
15751582 cx. external_paths . borrow_mut ( ) . as_mut ( ) . unwrap ( ) . insert ( did, ( fqn, TypeTrait ) ) ;
15761583 ResolvedPath {
15771584 path : path,
1578- typarams : Some ( bounds . clean ( cx ) ) ,
1585+ typarams : Some ( typarams ) ,
15791586 did : did,
15801587 }
15811588 }
0 commit comments