@@ -410,14 +410,14 @@ pub fn print_type(s: @ps, ty: @ast::Ty) {
410
410
let generics = ast:: Generics { lifetimes : copy f. lifetimes,
411
411
ty_params : opt_vec:: Empty } ;
412
412
print_ty_fn( s, Some ( f. abis) , None , None ,
413
- f. purity, ast:: Many , & f. decl, None ,
413
+ f. purity, ast:: Many , & f. decl, None , & None ,
414
414
Some ( & generics) , None ) ;
415
415
}
416
416
ast:: ty_closure( f) => {
417
417
let generics = ast:: Generics { lifetimes : copy f. lifetimes,
418
418
ty_params : opt_vec:: Empty } ;
419
419
print_ty_fn( s, None , Some ( f. sigil) , f. region,
420
- f. purity, f. onceness, & f. decl, None ,
420
+ f. purity, f. onceness, & f. decl, None , & f . bounds ,
421
421
Some ( & generics) , None ) ;
422
422
}
423
423
ast:: ty_path( path, bounds, _) => print_bounded_path( s, path, bounds) ,
@@ -806,7 +806,7 @@ pub fn print_ty_method(s: @ps, m: &ast::ty_method) {
806
806
maybe_print_comment( s, m. span. lo) ;
807
807
print_outer_attributes( s, m. attrs) ;
808
808
print_ty_fn( s, None , None , None , m. purity, ast:: Many ,
809
- & m. decl, Some ( m. ident) , Some ( & m. generics) ,
809
+ & m. decl, Some ( m. ident) , & None , Some ( & m. generics) ,
810
810
Some ( /*bad*/ copy m. explicit_self. node) ) ;
811
811
word( s. s, ";" ) ;
812
812
}
@@ -1497,7 +1497,7 @@ fn print_path_(s: @ps, path: @ast::Path, colons_before_params: bool,
1497
1497
print_ident( s, * id) ;
1498
1498
}
1499
1499
do opt_bounds. map |bounds| {
1500
- print_bounds( s, bounds) ;
1500
+ print_bounds( s, bounds, true ) ;
1501
1501
} ;
1502
1502
if path. rp. is_some( ) || !path. types. is_empty( ) {
1503
1503
if colons_before_params { word( s. s, ":: ") ; }
@@ -1737,7 +1737,8 @@ pub fn print_fn_block_args(s: @ps, decl: &ast::fn_decl) {
1737
1737
maybe_print_comment( s, decl. output. span. lo) ;
1738
1738
}
1739
1739
1740
- pub fn print_bounds( s: @ps, bounds: & OptVec <ast:: TyParamBound >) {
1740
+ pub fn print_bounds( s: @ps, bounds: & OptVec <ast:: TyParamBound >,
1741
+ print_colon_anyway: bool ) {
1741
1742
if !bounds. is_empty( ) {
1742
1743
word( s. s, ": ") ;
1743
1744
let mut first = true;
@@ -1754,6 +1755,8 @@ pub fn print_bounds(s: @ps, bounds: &OptVec<ast::TyParamBound>) {
1754
1755
RegionTyParamBound => word( s. s, "' static ") ,
1755
1756
}
1756
1757
}
1758
+ } else if print_colon_anyway {
1759
+ word( s. s, ": ") ;
1757
1760
}
1758
1761
}
1759
1762
@@ -1774,7 +1777,7 @@ pub fn print_generics(s: @ps, generics: &ast::Generics) {
1774
1777
let idx = idx - generics. lifetimes. len( ) ;
1775
1778
let param = generics. ty_params. get( idx) ;
1776
1779
print_ident( s, param. ident) ;
1777
- print_bounds( s, param. bounds) ;
1780
+ print_bounds( s, param. bounds, false ) ;
1778
1781
}
1779
1782
}
1780
1783
@@ -1917,6 +1920,7 @@ pub fn print_ty_fn(s: @ps,
1917
1920
onceness: ast:: Onceness ,
1918
1921
decl: & ast:: fn_decl,
1919
1922
id: Option <ast:: ident>,
1923
+ opt_bounds: & Option <OptVec <ast:: TyParamBound >>,
1920
1924
generics: Option <& ast:: Generics >,
1921
1925
opt_explicit_self: Option <ast:: explicit_self_>) {
1922
1926
ibox( s, indent_unit) ;
@@ -1930,6 +1934,7 @@ pub fn print_ty_fn(s: @ps,
1930
1934
print_onceness( s, onceness) ;
1931
1935
word( s. s, "fn ") ;
1932
1936
match id { Some ( id) => { word( s. s, " ") ; print_ident( s, id) ; } _ => ( ) }
1937
+ do opt_bounds. map |bounds| { print_bounds( s, bounds, true ) ; } ;
1933
1938
match generics { Some ( g) => print_generics( s, g) , _ => ( ) }
1934
1939
zerobreak( s. s) ;
1935
1940
0 commit comments