Skip to content

Commit 50b3f52

Browse files
committed
---
yaml --- r: 4174 b: refs/heads/master c: 0334fae h: refs/heads/master v: v3
1 parent 6babcf5 commit 50b3f52

File tree

2 files changed

+16
-14
lines changed

2 files changed

+16
-14
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 30377a0d05f6d580f9ce727d9f6c3ba7b25e72f6
2+
refs/heads/master: 0334faef1fd37dd6f358984904d0772bcf70e4c6

trunk/src/comp/syntax/print/pprust.rs

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ fn path_to_str(p: &ast::path) -> str { be to_str(p, print_path); }
105105
fn fun_to_str(f: &ast::_fn, name: str, params: &ast::ty_param[]) -> str {
106106
let writer = ioivec::string_writer();
107107
let s = rust_printer(writer.get_writer());
108-
print_fn(s, f.decl, f.proto, name, params);
108+
print_fn(s, f.decl, f.proto, name, params, f.decl.constraints);
109109
eof(s.s);
110110
ret writer.get_str();
111111
}
@@ -337,8 +337,6 @@ fn print_type(s: &ps, ty: &ast::ty) {
337337
ast::ty_constr(t, cs) {
338338
print_type(s, *t);
339339
space(s.s);
340-
word(s.s, ":");
341-
space(s.s);
342340
word(s.s, ast_ty_constrs_str(cs));
343341
}
344342
}
@@ -363,7 +361,8 @@ fn print_native_item(s: &ps, item: &@ast::native_item) {
363361

364362

365363
ast::native_item_fn(lname, decl, typarams) {
366-
print_fn(s, decl, ast::proto_fn, item.ident, typarams);
364+
print_fn(s, decl, ast::proto_fn, item.ident, typarams,
365+
decl.constraints);
367366
alt lname {
368367
none. { }
369368
some(ss) { space(s.s); word_space(s, "="); print_string(s, ss); }
@@ -396,7 +395,8 @@ fn print_item(s: &ps, item: &@ast::item) {
396395

397396
}
398397
ast::item_fn(_fn, typarams) {
399-
print_fn(s, _fn.decl, _fn.proto, item.ident, typarams);
398+
print_fn(s, _fn.decl, _fn.proto, item.ident, typarams,
399+
_fn.decl.constraints);
400400
word(s.s, " ");
401401
print_block(s, _fn.body);
402402
}
@@ -502,7 +502,7 @@ fn print_item(s: &ps, item: &@ast::item) {
502502
hardbreak_if_not_bol(s);
503503
maybe_print_comment(s, meth.span.lo);
504504
print_fn(s, meth.node.meth.decl, meth.node.meth.proto,
505-
meth.node.ident, typarams);
505+
meth.node.ident, typarams, ~[]);
506506
word(s.s, " ");
507507
print_block(s, meth.node.meth.body);
508508
}
@@ -821,7 +821,7 @@ fn print_expr(s: &ps, expr: &@ast::expr) {
821821
}
822822
ast::expr_fn(f) {
823823
head(s, proto_to_str(f.proto));
824-
print_fn_args_and_ret(s, f.decl);
824+
print_fn_args_and_ret(s, f.decl, ~[]);
825825
space(s.s);
826826
print_block(s, f.body);
827827
}
@@ -970,12 +970,12 @@ fn print_expr(s: &ps, expr: &@ast::expr) {
970970
bopen(s);
971971

972972
// Methods
973-
for meth: @ast::method in anon_obj.methods {
973+
for meth: @ast::method in anon_obj.methods {
974974
let typarams: ast::ty_param[] = ~[];
975975
hardbreak_if_not_bol(s);
976976
maybe_print_comment(s, meth.span.lo);
977977
print_fn(s, meth.node.meth.decl, meth.node.meth.proto,
978-
meth.node.ident, typarams);
978+
meth.node.ident, typarams, ~[]);
979979
word(s.s, " ");
980980
print_block(s, meth.node.meth.body);
981981
}
@@ -1102,17 +1102,18 @@ fn print_pat(s: &ps, pat: &@ast::pat) {
11021102
}
11031103

11041104
fn print_fn(s: &ps, decl: ast::fn_decl, proto: ast::proto, name: str,
1105-
typarams: &ast::ty_param[]) {
1105+
typarams: &ast::ty_param[], constrs: (@ast::constr)[]) {
11061106
alt decl.purity {
11071107
ast::impure_fn. { head(s, proto_to_str(proto)); }
11081108
_ { head(s, "pred"); }
11091109
}
11101110
word(s.s, name);
11111111
print_type_params(s, typarams);
1112-
print_fn_args_and_ret(s, decl);
1112+
print_fn_args_and_ret(s, decl, constrs);
11131113
}
11141114

1115-
fn print_fn_args_and_ret(s: &ps, decl: &ast::fn_decl) {
1115+
fn print_fn_args_and_ret(s: &ps, decl: &ast::fn_decl,
1116+
constrs: (@ast::constr)[]) {
11161117
popen(s);
11171118
fn print_arg(s: &ps, x: &ast::arg) {
11181119
ibox(s, indent_unit);
@@ -1123,6 +1124,7 @@ fn print_fn_args_and_ret(s: &ps, decl: &ast::fn_decl) {
11231124
}
11241125
commasep(s, inconsistent, decl.inputs, print_arg);
11251126
pclose(s);
1127+
word(s.s, ast_constrs_str(constrs));
11261128
maybe_print_comment(s, decl.output.span.lo);
11271129
if decl.output.node != ast::ty_nil {
11281130
space_if_not_bol(s);
@@ -1275,7 +1277,7 @@ fn print_ty_fn(s: &ps, proto: &ast::proto, id: &option::t[str],
12751277
}
12761278
end(s);
12771279
}
1278-
word_space(s, ast_constrs_str(constrs));
1280+
word(s.s, ast_constrs_str(constrs));
12791281
end(s);
12801282
}
12811283

0 commit comments

Comments
 (0)