Skip to content

Commit 198f6a2

Browse files
committed
Print iters as iters not fns.
1 parent 023bbc0 commit 198f6a2

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

src/comp/pretty/pprust.rs

+11-6
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ fn item_to_str(&@ast::item ty) -> str { be to_str(ty, print_item); }
7979
fn fun_to_str(&ast::_fn f, str name, vec[ast::ty_param] params) -> str {
8080
auto writer = io::string_writer();
8181
auto s = rust_printer(writer.get_writer());
82-
print_fn(s, f.decl, name, params);
82+
print_fn(s, f.decl, f.proto, name, params);
8383
eof(s.s);
8484
ret writer.get_str();
8585
}
@@ -279,7 +279,7 @@ fn print_item(&ps s, &@ast::item item) {
279279
end(s.s); // end the outer cbox
280280
}
281281
case (ast::item_fn(?name,?_fn,?typarams,_,_)) {
282-
print_fn(s, _fn.decl, name, typarams);
282+
print_fn(s, _fn.decl, _fn.proto, name, typarams);
283283
word(s.s, " ");
284284
print_block(s, _fn.body);
285285
}
@@ -312,7 +312,7 @@ fn print_item(&ps s, &@ast::item item) {
312312
}
313313
case (ast::native_item_fn(?id,?lname,?decl,
314314
?typarams,_,_)) {
315-
print_fn(s, decl, id, typarams);
315+
print_fn(s, decl, ast::proto_fn, id, typarams);
316316
end(s.s); // end head-ibox
317317
alt (lname) {
318318
case (option::none[str]) {}
@@ -388,7 +388,8 @@ fn print_item(&ps s, &@ast::item item) {
388388
let vec[ast::ty_param] typarams = [];
389389
hardbreak(s.s);
390390
maybe_print_comment(s, meth.span.lo);
391-
print_fn(s, meth.node.meth.decl, meth.node.ident, typarams);
391+
print_fn(s, meth.node.meth.decl, meth.node.meth.proto,
392+
meth.node.ident, typarams);
392393
word(s.s, " ");
393394
print_block(s, meth.node.meth.body);
394395
}
@@ -934,11 +935,15 @@ fn print_pat(&ps s, &@ast::pat pat) {
934935
}
935936
}
936937

937-
fn print_fn(&ps s, ast::fn_decl decl, str name,
938+
fn print_fn(&ps s, ast::fn_decl decl, ast::proto proto, str name,
938939
vec[ast::ty_param] typarams) {
939940
alt (decl.purity) {
940941
case (ast::impure_fn) {
941-
head(s, "fn");
942+
if (proto == ast::proto_iter) {
943+
head(s, "iter");
944+
} else {
945+
head(s, "fn");
946+
}
942947
}
943948
case (_) {
944949
head(s, "pred");

0 commit comments

Comments
 (0)