@@ -1379,17 +1379,18 @@ fn external_path(cx: &DocContext, name: &str, trait_did: Option<DefId>, has_self
1379
1379
}
1380
1380
}
1381
1381
1382
- impl < ' tcx > Clean < TyParamBound > for ty:: TraitRef < ' tcx > {
1382
+ impl < ' a , ' tcx > Clean < TyParamBound > for ( & ' a ty:: TraitRef < ' tcx > , Vec < TypeBinding > ) {
1383
1383
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 ) ;
1387
1388
1388
- debug ! ( "ty::TraitRef\n subst: {:?}\n " , self . substs) ;
1389
+ debug ! ( "ty::TraitRef\n subst: {:?}\n " , trait_ref . substs) ;
1389
1390
1390
1391
// collect any late bound regions
1391
1392
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 ) {
1393
1394
if let ty:: TyTuple ( ts) = ty_s. sty {
1394
1395
for & ty_s in ts {
1395
1396
if let ty:: TyRef ( ref reg, _) = ty_s. sty {
@@ -1409,7 +1410,7 @@ impl<'tcx> Clean<TyParamBound> for ty::TraitRef<'tcx> {
1409
1410
trait_ : ResolvedPath {
1410
1411
path,
1411
1412
typarams : None ,
1412
- did : self . def_id ,
1413
+ did : trait_ref . def_id ,
1413
1414
is_generic : false ,
1414
1415
} ,
1415
1416
generic_params : late_bounds,
@@ -1419,6 +1420,12 @@ impl<'tcx> Clean<TyParamBound> for ty::TraitRef<'tcx> {
1419
1420
}
1420
1421
}
1421
1422
1423
+ impl < ' tcx > Clean < TyParamBound > for ty:: TraitRef < ' tcx > {
1424
+ fn clean ( & self , cx : & DocContext ) -> TyParamBound {
1425
+ ( self , vec ! [ ] ) . clean ( cx)
1426
+ }
1427
+ }
1428
+
1422
1429
impl < ' tcx > Clean < Option < Vec < TyParamBound > > > for Substs < ' tcx > {
1423
1430
fn clean ( & self , cx : & DocContext ) -> Option < Vec < TyParamBound > > {
1424
1431
let mut v = Vec :: new ( ) ;
@@ -2757,7 +2764,30 @@ impl<'tcx> Clean<Type> for Ty<'tcx> {
2757
2764
let substs = cx. tcx . lift ( & substs) . unwrap ( ) ;
2758
2765
let bounds = predicates_of. instantiate ( cx. tcx , substs) ;
2759
2766
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) )
2761
2791
} ) . collect ( ) )
2762
2792
}
2763
2793
0 commit comments