@@ -473,26 +473,29 @@ impl Clean<TyParam> for ty::TypeParameterDef {
473473
474474#[ deriving( Clone , Encodable , Decodable , PartialEq ) ]
475475pub enum TyParamBound {
476- RegionBound , // FIXME(#16518) -- need to include name of actual region
476+ RegionBound ( Lifetime ) ,
477+ UnboxedFnBound , // FIXME
478+ UnknownBound ,
477479 TraitBound ( Type )
478480}
479481
480482impl Clean < TyParamBound > for ast:: TyParamBound {
481483 fn clean ( & self , cx : & DocContext ) -> TyParamBound {
482484 match * self {
483- ast:: RegionTyParamBound ( _ ) => RegionBound ,
485+ ast:: RegionTyParamBound ( lt ) => RegionBound ( lt . clean ( cx ) ) ,
484486 ast:: UnboxedFnTyParamBound ( _) => {
485487 // FIXME(pcwalton): Wrong.
486- RegionBound
487- }
488+ UnboxedFnBound
489+ } ,
488490 ast:: TraitTyParamBound ( ref t) => TraitBound ( t. clean ( cx) ) ,
489491 }
490492 }
491493}
492494
493495impl Clean < Vec < TyParamBound > > for ty:: ExistentialBounds {
494496 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) ) ) ;
496499 for bb in self . builtin_bounds . iter ( ) {
497500 vec. push ( bb. clean ( cx) ) ;
498501 }
@@ -521,7 +524,7 @@ impl Clean<TyParamBound> for ty::BuiltinBound {
521524 fn clean ( & self , cx : & DocContext ) -> TyParamBound {
522525 let tcx = match cx. tcx_opt ( ) {
523526 Some ( tcx) => tcx,
524- None => return RegionBound ,
527+ None => return UnknownBound
525528 } ;
526529 let empty = subst:: Substs :: empty ( ) ;
527530 let ( did, path) = match * self {
@@ -554,7 +557,7 @@ impl Clean<TyParamBound> for ty::TraitRef {
554557 fn clean ( & self , cx : & DocContext ) -> TyParamBound {
555558 let tcx = match cx. tcx_opt ( ) {
556559 Some ( tcx) => tcx,
557- None => return RegionBound ,
560+ None => return UnknownBound
558561 } ;
559562 let fqn = csearch:: get_item_path ( tcx, self . def_id ) ;
560563 let fqn = fqn. into_iter ( ) . map ( |i| i. to_string ( ) )
@@ -589,7 +592,7 @@ impl Clean<Vec<TyParamBound>> for ty::ParamBounds {
589592impl Clean < Option < Vec < TyParamBound > > > for subst:: Substs {
590593 fn clean ( & self , cx : & DocContext ) -> Option < Vec < TyParamBound > > {
591594 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 ) ) ;
593596 v. extend ( self . types . iter ( ) . map ( |t| TraitBound ( t. clean ( cx) ) ) ) ;
594597 if v. len ( ) > 0 { Some ( v) } else { None }
595598 }
@@ -604,6 +607,10 @@ impl Lifetime {
604607 let s: & ' a str = s. as_slice ( ) ;
605608 return s;
606609 }
610+
611+ pub fn statik ( ) -> Lifetime {
612+ Lifetime ( "'static" . to_string ( ) )
613+ }
607614}
608615
609616impl Clean < Lifetime > for ast:: Lifetime {
@@ -627,7 +634,7 @@ impl Clean<Lifetime> for ty::RegionParameterDef {
627634impl Clean < Option < Lifetime > > for ty:: Region {
628635 fn clean ( & self , cx : & DocContext ) -> Option < Lifetime > {
629636 match * self {
630- ty:: ReStatic => Some ( Lifetime ( "'static" . to_string ( ) ) ) ,
637+ ty:: ReStatic => Some ( Lifetime :: statik ( ) ) ,
631638 ty:: ReLateBound ( _, ty:: BrNamed ( _, name) ) =>
632639 Some ( Lifetime ( token:: get_name ( name) . get ( ) . to_string ( ) ) ) ,
633640 ty:: ReEarlyBound ( _, _, _, name) => Some ( Lifetime ( name. clean ( cx) ) ) ,
0 commit comments