Skip to content

Commit c2751c5

Browse files
committed
rustc: Make 'do' work with effects the same as 'for'
1 parent 8ed9701 commit c2751c5

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/rustc/middle/borrowck/check_loans.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ impl methods for check_loan_ctxt {
185185
if is_fn_arg { ret; } // case (a) above
186186
}
187187
ast::expr_fn_block(*) | ast::expr_fn(*) |
188-
ast::expr_loop_body(*) {
188+
ast::expr_loop_body(*) | ast::expr_do_body(*) {
189189
if self.is_stack_closure(expr.id) { ret; } // case (b) above
190190
}
191191
_ {}

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
pure fn f(f: fn()) {
2+
}
3+
4+
pure fn g() {
5+
// `f { || }` is considered pure, so `do f { || }` should be too
6+
do f { || }
7+
}
8+
9+
fn main() {
10+
}

0 commit comments

Comments
 (0)