Skip to content

Commit e991855

Browse files
committed
Make 'do' expressions accept stack closures
1 parent c01f5ef commit e991855

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/rustc/middle/block_use.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ fn visit_expr(ex: @expr, cx: ctx, v: visit::vt<ctx>) {
3434
i += 1u;
3535
}
3636
}
37-
expr_loop_body(body) {
37+
expr_loop_body(body) | expr_do_body(body) {
3838
cx.allow_block = true;
3939
v.visit_expr(body, cx, v);
4040
}

src/test/run-pass/do-stack.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
fn f(f: fn&(int)) { f(10) }
2+
3+
fn main() {
4+
do f() { |i| assert i == 10 }
5+
}

0 commit comments

Comments
 (0)