@@ -2763,20 +2763,26 @@ impl<'tcx> Clean<Type> for Ty<'tcx> {
2763
2763
let predicates_of = cx. tcx . predicates_of ( def_id) ;
2764
2764
let substs = cx. tcx . lift ( & substs) . unwrap ( ) ;
2765
2765
let bounds = predicates_of. instantiate ( cx. tcx , substs) ;
2766
- ImplTrait ( bounds. predicates . iter ( ) . filter_map ( |predicate| {
2766
+ let mut regions = vec ! [ ] ;
2767
+ let mut has_sized = false ;
2768
+ let mut bounds = bounds. predicates . iter ( ) . filter_map ( |predicate| {
2767
2769
let trait_ref = if let Some ( tr) = predicate. to_opt_poly_trait_ref ( ) {
2768
2770
tr
2771
+ } else if let ty:: Predicate :: TypeOutlives ( pred) = * predicate {
2772
+ // these should turn up at the end
2773
+ pred. skip_binder ( ) . 1 . clean ( cx) . map ( |r| regions. push ( RegionBound ( r) ) ) ;
2774
+ return None ;
2769
2775
} else {
2770
2776
return None ;
2771
2777
} ;
2772
2778
2773
2779
if let Some ( sized) = cx. tcx . lang_items ( ) . sized_trait ( ) {
2774
2780
if trait_ref. def_id ( ) == sized {
2781
+ has_sized = true ;
2775
2782
return None ;
2776
2783
}
2777
2784
}
2778
2785
2779
- // FIXME(Manishearth) handle cases which aren't Sized
2780
2786
2781
2787
let bounds = bounds. predicates . iter ( ) . filter_map ( |pred|
2782
2788
if let ty:: Predicate :: Projection ( proj) = * pred {
@@ -2796,7 +2802,12 @@ impl<'tcx> Clean<Type> for Ty<'tcx> {
2796
2802
) . collect ( ) ;
2797
2803
2798
2804
Some ( ( trait_ref. skip_binder ( ) , bounds) . clean ( cx) )
2799
- } ) . collect ( ) )
2805
+ } ) . collect :: < Vec < _ > > ( ) ;
2806
+ bounds. extend ( regions) ;
2807
+ if !has_sized && !bounds. is_empty ( ) {
2808
+ bounds. insert ( 0 , TyParamBound :: maybe_sized ( cx) ) ;
2809
+ }
2810
+ ImplTrait ( bounds)
2800
2811
}
2801
2812
2802
2813
ty:: TyClosure ( ..) | ty:: TyGenerator ( ..) => Tuple ( vec ! [ ] ) , // FIXME(pcwalton)
0 commit comments