rustc: Make 'do' work with effects the same as 'for'

This commit is contained in:
Brian Anderson 2012-06-25 17:46:00 -07:00
parent 8ed9701591
commit c2751c5640
2 changed files with 11 additions and 1 deletions

View file

@ -185,7 +185,7 @@ impl methods for check_loan_ctxt {
if is_fn_arg { ret; } // case (a) above
}
ast::expr_fn_block(*) | ast::expr_fn(*) |
ast::expr_loop_body(*) {
ast::expr_loop_body(*) | ast::expr_do_body(*) {
if self.is_stack_closure(expr.id) { ret; } // case (b) above
}
_ {}

View file

@ -0,0 +1,10 @@
pure fn f(f: fn()) {
}
pure fn g() {
// `f { || }` is considered pure, so `do f { || }` should be too
do f { || }
}
fn main() {
}