@@ -504,22 +504,28 @@ impl Clean<TyParamBound> for ast::TyParamBound {
504
504
}
505
505
}
506
506
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) ) ) ;
511
511
for bb in self . builtin_bounds . iter ( ) {
512
- vec . push ( bb. clean ( cx) ) ;
512
+ tp_bounds . push ( bb. clean ( cx) ) ;
513
513
}
514
514
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
+ }
516
522
517
- vec
523
+ ( tp_bounds , bindings )
518
524
}
519
525
}
520
526
521
527
fn external_path_params ( cx : & DocContext , trait_did : Option < ast:: DefId > ,
522
- substs : & subst:: Substs ) -> PathParameters {
528
+ bindings : Vec < TypeBinding > , substs : & subst:: Substs ) -> PathParameters {
523
529
use rustc:: middle:: ty:: sty;
524
530
let lifetimes = substs. regions ( ) . get_slice ( subst:: TypeSpace )
525
531
. iter ( )
@@ -537,7 +543,7 @@ fn external_path_params(cx: &DocContext, trait_did: Option<ast::DefId>,
537
543
return PathParameters :: AngleBracketed {
538
544
lifetimes : lifetimes,
539
545
types : types. clean ( cx) ,
540
- bindings : vec ! [ ]
546
+ bindings : bindings
541
547
}
542
548
}
543
549
} ;
@@ -554,7 +560,7 @@ fn external_path_params(cx: &DocContext, trait_did: Option<ast::DefId>,
554
560
PathParameters :: AngleBracketed {
555
561
lifetimes : lifetimes,
556
562
types : types. clean ( cx) ,
557
- bindings : vec ! [ ] // FIXME(#20646)
563
+ bindings : bindings
558
564
}
559
565
}
560
566
}
@@ -563,12 +569,12 @@ fn external_path_params(cx: &DocContext, trait_did: Option<ast::DefId>,
563
569
// trait_did should be set to a trait's DefId if called on a TraitRef, in order to sugar
564
570
// from Fn<(A, B,), C> to Fn(A, B) -> C
565
571
fn external_path ( cx : & DocContext , name : & str , trait_did : Option < ast:: DefId > ,
566
- substs : & subst:: Substs ) -> Path {
572
+ bindings : Vec < TypeBinding > , substs : & subst:: Substs ) -> Path {
567
573
Path {
568
574
global : false ,
569
575
segments : vec ! [ PathSegment {
570
576
name: name. to_string( ) ,
571
- params: external_path_params( cx, trait_did, substs)
577
+ params: external_path_params( cx, trait_did, bindings , substs)
572
578
} ] ,
573
579
}
574
580
}
@@ -583,16 +589,16 @@ impl Clean<TyParamBound> for ty::BuiltinBound {
583
589
let ( did, path) = match * self {
584
590
ty:: BoundSend =>
585
591
( tcx. lang_items . send_trait ( ) . unwrap ( ) ,
586
- external_path ( cx, "Send" , None , & empty) ) ,
592
+ external_path ( cx, "Send" , None , vec ! [ ] , & empty) ) ,
587
593
ty:: BoundSized =>
588
594
( tcx. lang_items . sized_trait ( ) . unwrap ( ) ,
589
- external_path ( cx, "Sized" , None , & empty) ) ,
595
+ external_path ( cx, "Sized" , None , vec ! [ ] , & empty) ) ,
590
596
ty:: BoundCopy =>
591
597
( tcx. lang_items . copy_trait ( ) . unwrap ( ) ,
592
- external_path ( cx, "Copy" , None , & empty) ) ,
598
+ external_path ( cx, "Copy" , None , vec ! [ ] , & empty) ) ,
593
599
ty:: BoundSync =>
594
600
( tcx. lang_items . sync_trait ( ) . unwrap ( ) ,
595
- external_path ( cx, "Sync" , None , & empty) ) ,
601
+ external_path ( cx, "Sync" , None , vec ! [ ] , & empty) ) ,
596
602
} ;
597
603
let fqn = csearch:: get_item_path ( tcx, did) ;
598
604
let fqn = fqn. into_iter ( ) . map ( |i| i. to_string ( ) ) . collect ( ) ;
@@ -619,7 +625,7 @@ impl<'tcx> Clean<TyParamBound> for ty::TraitRef<'tcx> {
619
625
let fqn = fqn. into_iter ( ) . map ( |i| i. to_string ( ) )
620
626
. collect :: < Vec < String > > ( ) ;
621
627
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 ) ;
623
629
cx. external_paths . borrow_mut ( ) . as_mut ( ) . unwrap ( ) . insert ( self . def_id ,
624
630
( fqn, TypeTrait ) ) ;
625
631
@@ -1558,7 +1564,7 @@ impl<'tcx> Clean<Type> for ty::Ty<'tcx> {
1558
1564
_ => TypeEnum ,
1559
1565
} ;
1560
1566
let path = external_path ( cx, fqn. last ( ) . unwrap ( ) . to_string ( ) . as_slice ( ) ,
1561
- None , substs) ;
1567
+ None , vec ! [ ] , substs) ;
1562
1568
cx. external_paths . borrow_mut ( ) . as_mut ( ) . unwrap ( ) . insert ( did, ( fqn, kind) ) ;
1563
1569
ResolvedPath {
1564
1570
path : path,
@@ -1570,12 +1576,13 @@ impl<'tcx> Clean<Type> for ty::Ty<'tcx> {
1570
1576
let did = principal. def_id ( ) ;
1571
1577
let fqn = csearch:: get_item_path ( cx. tcx ( ) , did) ;
1572
1578
let fqn: Vec < _ > = fqn. into_iter ( ) . map ( |i| i. to_string ( ) ) . collect ( ) ;
1579
+ let ( typarams, bindings) = bounds. clean ( cx) ;
1573
1580
let path = external_path ( cx, fqn. last ( ) . unwrap ( ) . to_string ( ) . as_slice ( ) ,
1574
- Some ( did) , principal. substs ( ) ) ;
1581
+ Some ( did) , bindings , principal. substs ( ) ) ;
1575
1582
cx. external_paths . borrow_mut ( ) . as_mut ( ) . unwrap ( ) . insert ( did, ( fqn, TypeTrait ) ) ;
1576
1583
ResolvedPath {
1577
1584
path : path,
1578
- typarams : Some ( bounds . clean ( cx ) ) ,
1585
+ typarams : Some ( typarams ) ,
1579
1586
did : did,
1580
1587
}
1581
1588
}
0 commit comments