@@ -462,6 +462,7 @@ impl Clean<TyParam> for ty::TypeParameterDef {
462462 fn clean ( & self , cx : & DocContext ) -> TyParam {
463463 cx. external_typarams . borrow_mut ( ) . as_mut ( ) . unwrap ( )
464464 . insert ( self . def_id , self . ident . clean ( cx) ) ;
465+
465466 TyParam {
466467 name : self . ident . clean ( cx) ,
467468 did : self . def_id ,
@@ -473,26 +474,25 @@ impl Clean<TyParam> for ty::TypeParameterDef {
473474
474475#[ deriving( Clone , Encodable , Decodable , PartialEq ) ]
475476pub enum TyParamBound {
476- RegionBound , // FIXME(#16518) -- need to include name of actual region
477+ RegionBound ( Lifetime ) ,
478+ UnboxedFnBound ( UnboxedFnType ) ,
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 ,
484- ast:: UnboxedFnTyParamBound ( _) => {
485- // FIXME(pcwalton): Wrong.
486- RegionBound
487- }
485+ ast:: RegionTyParamBound ( lt) => RegionBound ( lt. clean ( cx) ) ,
486+ ast:: UnboxedFnTyParamBound ( ref ty) => { UnboxedFnBound ( ty. clean ( cx) ) } ,
488487 ast:: TraitTyParamBound ( ref t) => TraitBound ( t. clean ( cx) ) ,
489488 }
490489 }
491490}
492491
493492impl Clean < Vec < TyParamBound > > for ty:: ExistentialBounds {
494493 fn clean ( & self , cx : & DocContext ) -> Vec < TyParamBound > {
495- let mut vec = vec ! ( RegionBound ) ;
494+ let mut vec = vec ! [ ] ;
495+ self . region_bound . clean ( cx) . map ( |b| vec. push ( RegionBound ( b) ) ) ;
496496 for bb in self . builtin_bounds . iter ( ) {
497497 vec. push ( bb. clean ( cx) ) ;
498498 }
@@ -521,7 +521,7 @@ impl Clean<TyParamBound> for ty::BuiltinBound {
521521 fn clean ( & self , cx : & DocContext ) -> TyParamBound {
522522 let tcx = match cx. tcx_opt ( ) {
523523 Some ( tcx) => tcx,
524- None => return RegionBound ,
524+ None => return RegionBound ( Lifetime :: statik ( ) )
525525 } ;
526526 let empty = subst:: Substs :: empty ( ) ;
527527 let ( did, path) = match * self {
@@ -554,7 +554,7 @@ impl Clean<TyParamBound> for ty::TraitRef {
554554 fn clean ( & self , cx : & DocContext ) -> TyParamBound {
555555 let tcx = match cx. tcx_opt ( ) {
556556 Some ( tcx) => tcx,
557- None => return RegionBound ,
557+ None => return RegionBound ( Lifetime :: statik ( ) )
558558 } ;
559559 let fqn = csearch:: get_item_path ( tcx, self . def_id ) ;
560560 let fqn = fqn. into_iter ( ) . map ( |i| i. to_string ( ) )
@@ -582,19 +582,37 @@ impl Clean<Vec<TyParamBound>> for ty::ParamBounds {
582582 for t in self . trait_bounds . iter ( ) {
583583 v. push ( t. clean ( cx) ) ;
584584 }
585+ for r in self . region_bounds . iter ( ) . filter_map ( |r| r. clean ( cx) ) {
586+ v. push ( RegionBound ( r) ) ;
587+ }
585588 return v;
586589 }
587590}
588591
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 }
596599}
597600
601+ #[ deriving( Clone , Encodable , Decodable , PartialEq ) ]
602+ pub struct UnboxedFnType {
603+ pub path : Path ,
604+ pub decl : FnDecl
605+ }
606+
607+ impl Clean < UnboxedFnType > for ast:: UnboxedFnBound {
608+ fn clean ( & self , cx : & DocContext ) -> UnboxedFnType {
609+ UnboxedFnType {
610+ path : self . path . clean ( cx) ,
611+ decl : self . decl . clean ( cx)
612+ }
613+ }
614+ }
615+
598616#[ deriving( Clone , Encodable , Decodable , PartialEq ) ]
599617pub struct Lifetime ( String ) ;
600618
@@ -604,6 +622,10 @@ impl Lifetime {
604622 let s: & ' a str = s. as_slice ( ) ;
605623 return s;
606624 }
625+
626+ pub fn statik ( ) -> Lifetime {
627+ Lifetime ( "'static" . to_string ( ) )
628+ }
607629}
608630
609631impl Clean < Lifetime > for ast:: Lifetime {
@@ -627,7 +649,7 @@ impl Clean<Lifetime> for ty::RegionParameterDef {
627649impl Clean < Option < Lifetime > > for ty:: Region {
628650 fn clean ( & self , cx : & DocContext ) -> Option < Lifetime > {
629651 match * self {
630- ty:: ReStatic => Some ( Lifetime ( "'static" . to_string ( ) ) ) ,
652+ ty:: ReStatic => Some ( Lifetime :: statik ( ) ) ,
631653 ty:: ReLateBound ( _, ty:: BrNamed ( _, name) ) =>
632654 Some ( Lifetime ( token:: get_name ( name) . get ( ) . to_string ( ) ) ) ,
633655 ty:: ReEarlyBound ( _, _, _, name) => Some ( Lifetime ( name. clean ( cx) ) ) ,
0 commit comments