@@ -473,26 +473,29 @@ impl Clean<TyParam> for ty::TypeParameterDef {
473
473
474
474
#[ deriving( Clone , Encodable , Decodable , PartialEq ) ]
475
475
pub enum TyParamBound {
476
- RegionBound , // FIXME(#16518) -- need to include name of actual region
476
+ RegionBound ( Lifetime ) ,
477
+ UnboxedFnBound , // FIXME
478
+ UnknownBound ,
477
479
TraitBound ( Type )
478
480
}
479
481
480
482
impl Clean < TyParamBound > for ast:: TyParamBound {
481
483
fn clean ( & self , cx : & DocContext ) -> TyParamBound {
482
484
match * self {
483
- ast:: RegionTyParamBound ( _ ) => RegionBound ,
485
+ ast:: RegionTyParamBound ( lt ) => RegionBound ( lt . clean ( cx ) ) ,
484
486
ast:: UnboxedFnTyParamBound ( _) => {
485
487
// FIXME(pcwalton): Wrong.
486
- RegionBound
487
- }
488
+ UnboxedFnBound
489
+ } ,
488
490
ast:: TraitTyParamBound ( ref t) => TraitBound ( t. clean ( cx) ) ,
489
491
}
490
492
}
491
493
}
492
494
493
495
impl Clean < Vec < TyParamBound > > for ty:: ExistentialBounds {
494
496
fn clean ( & self , cx : & DocContext ) -> Vec < TyParamBound > {
495
- let mut vec = vec ! ( RegionBound ) ;
497
+ let mut vec = vec ! [ ] ;
498
+ self . region_bound . clean ( cx) . map ( |b| vec. push ( RegionBound ( b) ) ) ;
496
499
for bb in self . builtin_bounds . iter ( ) {
497
500
vec. push ( bb. clean ( cx) ) ;
498
501
}
@@ -521,7 +524,7 @@ impl Clean<TyParamBound> for ty::BuiltinBound {
521
524
fn clean ( & self , cx : & DocContext ) -> TyParamBound {
522
525
let tcx = match cx. tcx_opt ( ) {
523
526
Some ( tcx) => tcx,
524
- None => return RegionBound ,
527
+ None => return UnknownBound
525
528
} ;
526
529
let empty = subst:: Substs :: empty ( ) ;
527
530
let ( did, path) = match * self {
@@ -554,7 +557,7 @@ impl Clean<TyParamBound> for ty::TraitRef {
554
557
fn clean ( & self , cx : & DocContext ) -> TyParamBound {
555
558
let tcx = match cx. tcx_opt ( ) {
556
559
Some ( tcx) => tcx,
557
- None => return RegionBound ,
560
+ None => return UnknownBound
558
561
} ;
559
562
let fqn = csearch:: get_item_path ( tcx, self . def_id ) ;
560
563
let fqn = fqn. into_iter ( ) . map ( |i| i. to_string ( ) )
@@ -589,7 +592,7 @@ impl Clean<Vec<TyParamBound>> for ty::ParamBounds {
589
592
impl Clean < Option < Vec < TyParamBound > > > for subst:: Substs {
590
593
fn clean ( & self , cx : & DocContext ) -> Option < Vec < TyParamBound > > {
591
594
let mut v = Vec :: new ( ) ;
592
- v. extend ( self . regions ( ) . iter ( ) . map ( |_| RegionBound ) ) ;
595
+ v. extend ( self . regions ( ) . iter ( ) . filter_map ( |r| r . clean ( cx ) ) . map ( RegionBound ) ) ;
593
596
v. extend ( self . types . iter ( ) . map ( |t| TraitBound ( t. clean ( cx) ) ) ) ;
594
597
if v. len ( ) > 0 { Some ( v) } else { None }
595
598
}
@@ -604,6 +607,10 @@ impl Lifetime {
604
607
let s: & ' a str = s. as_slice ( ) ;
605
608
return s;
606
609
}
610
+
611
+ pub fn statik ( ) -> Lifetime {
612
+ Lifetime ( "'static" . to_string ( ) )
613
+ }
607
614
}
608
615
609
616
impl Clean < Lifetime > for ast:: Lifetime {
@@ -627,7 +634,7 @@ impl Clean<Lifetime> for ty::RegionParameterDef {
627
634
impl Clean < Option < Lifetime > > for ty:: Region {
628
635
fn clean ( & self , cx : & DocContext ) -> Option < Lifetime > {
629
636
match * self {
630
- ty:: ReStatic => Some ( Lifetime ( "'static" . to_string ( ) ) ) ,
637
+ ty:: ReStatic => Some ( Lifetime :: statik ( ) ) ,
631
638
ty:: ReLateBound ( _, ty:: BrNamed ( _, name) ) =>
632
639
Some ( Lifetime ( token:: get_name ( name) . get ( ) . to_string ( ) ) ) ,
633
640
ty:: ReEarlyBound ( _, _, _, name) => Some ( Lifetime ( name. clean ( cx) ) ) ,
0 commit comments