@@ -279,18 +279,17 @@ fn path(w: &mut io::Writer, path: &clean::Path, print_all: bool,
279
279
}
280
280
281
281
/// Helper to render type parameters
282
- fn typarams ( w: & mut io:: Writer ,
282
+ fn tybounds ( w: & mut io:: Writer ,
283
283
typarams: & Option < Vec < clean:: TyParamBound > > ) -> fmt:: Result {
284
284
match * typarams {
285
285
Some ( ref params) => {
286
- try!( write!( w, "< " ) ) ;
286
+ try!( write!( w, ": ") ) ;
287
287
for ( i, param) in params. iter( ) . enumerate( ) {
288
288
if i > 0 {
289
- try!( write!( w, ", ") ) ;
289
+ try!( write!( w, " + " ) ) ;
290
290
}
291
291
try!( write ! ( w, "{}" , * param) ) ;
292
292
}
293
- try!( write!( w, "& gt; ") ) ;
294
293
Ok ( ( ) )
295
294
}
296
295
None => Ok ( ( ) )
@@ -308,13 +307,13 @@ impl fmt::Show for clean::Type {
308
307
}
309
308
clean:: ResolvedPath { id, typarams : ref tp, path : ref path} => {
310
309
try!( resolved_path ( f. buf , id, path, false ) ) ;
311
- typarams ( f. buf , tp)
310
+ tybounds ( f. buf , tp)
312
311
}
313
312
clean:: ExternalPath { path : ref path, typarams : ref tp,
314
313
fqn : ref fqn, kind, krate} => {
315
314
try!( external_path ( f. buf , path, false , fqn. as_slice ( ) , kind,
316
315
krate) )
317
- typarams ( f. buf , tp)
316
+ tybounds ( f. buf , tp)
318
317
}
319
318
clean:: Self ( ..) => f. buf . write ( "Self" . as_bytes ( ) ) ,
320
319
clean:: Primitive ( prim) => {
@@ -338,26 +337,59 @@ impl fmt::Show for clean::Type {
338
337
f. buf . write ( s. as_bytes ( ) )
339
338
}
340
339
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,
350
349
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
+ } )
353
374
}
354
375
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
+ } ,
358
391
arrow = match decl. decl. output { clean:: Unit => "no" , _ => "yes" } ,
359
392
ret = decl. decl. output)
360
- // FIXME: where are bounds and lifetimes printed?!
361
393
}
362
394
clean:: BareFunction ( ref decl) => {
363
395
write ! ( f. buf, "{}{}fn{}{}" ,
0 commit comments