rustc: Make 'do' work with effects the same as 'for'
This commit is contained in:
parent
8ed9701591
commit
c2751c5640
@ -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
|
||||
}
|
||||
_ {}
|
||||
|
10
src/test/run-pass/do-pure.rs
Normal file
10
src/test/run-pass/do-pure.rs
Normal 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() {
|
||||
}
|
Loading…
Reference in New Issue
Block a user