@@ -279,18 +279,17 @@ fn path(w: &mut io::Writer, path: &clean::Path, print_all: bool,
279279}
280280
281281/// Helper to render type parameters
282- fn typarams ( w: & mut io:: Writer ,
282+ fn tybounds ( w: & mut io:: Writer ,
283283 typarams: & Option < Vec < clean:: TyParamBound > > ) -> fmt:: Result {
284284 match * typarams {
285285 Some ( ref params) => {
286- try!( write!( w, "< " ) ) ;
286+ try!( write!( w, ": ") ) ;
287287 for ( i, param) in params. iter( ) . enumerate( ) {
288288 if i > 0 {
289- try!( write!( w, ", ") ) ;
289+ try!( write!( w, " + " ) ) ;
290290 }
291291 try!( write ! ( w, "{}" , * param) ) ;
292292 }
293- try!( write!( w, "& gt; ") ) ;
294293 Ok ( ( ) )
295294 }
296295 None => Ok ( ( ) )
@@ -308,13 +307,13 @@ impl fmt::Show for clean::Type {
308307 }
309308 clean:: ResolvedPath { id, typarams : ref tp, path : ref path} => {
310309 try!( resolved_path ( f. buf , id, path, false ) ) ;
311- typarams ( f. buf , tp)
310+ tybounds ( f. buf , tp)
312311 }
313312 clean:: ExternalPath { path : ref path, typarams : ref tp,
314313 fqn : ref fqn, kind, krate} => {
315314 try!( external_path ( f. buf , path, false , fqn. as_slice ( ) , kind,
316315 krate) )
317- typarams ( f. buf , tp)
316+ tybounds ( f. buf , tp)
318317 }
319318 clean:: Self ( ..) => f. buf . write ( "Self" . as_bytes ( ) ) ,
320319 clean:: Primitive ( prim) => {
@@ -338,26 +337,59 @@ impl fmt::Show for clean::Type {
338337 f. buf . write ( s. as_bytes ( ) )
339338 }
340339 clean:: Closure ( ref decl, ref region) => {
341- let region = match * region {
342- Some ( ref region ) => format ! ( "{} " , * region ) ,
343- None => ~"" ,
344- } ;
345-
346- write ! ( f . buf , "{}{}|{}|{arrow, select, yes{ -> {ret}} other{}}" ,
347- FnStyleSpace ( decl. fn_style ) ,
348- region ,
349- decl. decl. inputs,
340+ write ! ( f . buf , "{style}{lifetimes}|{args}|{bounds} \
341+ {arrow, select, yes{ -> {ret}} other{}}" ,
342+ style = FnStyleSpace ( decl . fn_style ) ,
343+ lifetimes = if decl . lifetimes . len ( ) == 0 {
344+ ~""
345+ } else {
346+ format! ( "<{:#}>" , decl. lifetimes )
347+ } ,
348+ args = decl. decl. inputs,
350349 arrow = match decl. decl. output { clean:: Unit => "no" , _ => "yes" } ,
351- ret = decl. decl. output)
352- // FIXME: where are bounds and lifetimes printed?!
350+ ret = decl. decl. output,
351+ bounds = {
352+ let mut ret = StrBuf :: new( ) ;
353+ match * region {
354+ Some ( ref lt) => {
355+ ret. push_str( format!( ": {}" , * lt) ) ;
356+ }
357+ None => { }
358+ }
359+ for bound in decl. bounds. iter( ) {
360+ match * bound {
361+ clean:: RegionBound => { }
362+ clean:: TraitBound ( ref t) => {
363+ if ret. len( ) == 0 {
364+ ret. push_str( ": " ) ;
365+ } else {
366+ ret. push_str( " + " ) ;
367+ }
368+ ret. push_str( format!( "{}" , * t) ) ;
369+ }
370+ }
371+ }
372+ ret. into_owned( )
373+ } )
353374 }
354375 clean:: Proc ( ref decl) => {
355- write ! ( f. buf, "{}proc({}){arrow, select, yes{ -> {ret}} other{}}" ,
356- FnStyleSpace ( decl. fn_style) ,
357- decl. decl. inputs,
376+ write ! ( f. buf, "{style}{lifetimes}proc({args}){bounds}\
377+ {arrow, select, yes{ -> {ret}} other{}}",
378+ style = FnStyleSpace ( decl. fn_style) ,
379+ lifetimes = if decl. lifetimes. len( ) == 0 {
380+ ~""
381+ } else {
382+ format!( "<{:#}>" , decl. lifetimes)
383+ } ,
384+ args = decl. decl. inputs,
385+ bounds = if decl. bounds. len( ) == 0 {
386+ ~""
387+ } else {
388+ let mut m = decl. bounds. iter( ) . map( |s| s. to_str( ) ) ;
389+ ": " + m. collect:: <~[ ~str ] >( ) . connect( " + " )
390+ } ,
358391 arrow = match decl. decl. output { clean:: Unit => "no" , _ => "yes" } ,
359392 ret = decl. decl. output)
360- // FIXME: where are bounds and lifetimes printed?!
361393 }
362394 clean:: BareFunction ( ref decl) => {
363395 write ! ( f. buf, "{}{}fn{}{}" ,
0 commit comments