Skip to content

Commit 2c42af9

Browse files
committed
---
yaml --- r: 16108 b: refs/heads/try c: 79b3ded h: refs/heads/master v: v3
1 parent 2ccbfee commit 2c42af9

File tree

3 files changed

+23
-2
lines changed

3 files changed

+23
-2
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
refs/heads/master: 61b1875c16de39c166b0f4d54bba19f9c6777d1a
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
5-
refs/heads/try: 653a1f8781cd4148d836915228ac28f13853457d
5+
refs/heads/try: 79b3dedac3f50ec22d9fcab887f29d03ceec9406
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105

branches/try/src/rustc/middle/borrowck.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -654,7 +654,7 @@ impl methods for check_loan_ctxt {
654654
self.fn_args.contains(did.node);
655655
if is_fn_arg { ret; } // case (a) above
656656
}
657-
ast::expr_fn_block(*) | ast::expr_fn(*) {
657+
ast::expr_fn_block(*) | ast::expr_fn(*) | ast::expr_loop_body(*) {
658658
if self.is_stack_closure(expr.id) { ret; } // case (b) above
659659
}
660660
_ {}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
pure fn range(from: uint, to: uint, f: fn(uint) -> bool) {
2+
let mut i = from;
3+
while i < to {
4+
if !f(i) {ret;} // Note: legal to call argument, even if it is not pure.
5+
i += 1u;
6+
}
7+
}
8+
9+
pure fn range2(from: uint, to: uint, f: fn(uint)) {
10+
for range(from, to) { |i|
11+
f(i*2u);
12+
}
13+
}
14+
15+
pure fn range3(from: uint, to: uint, f: {x: fn(uint)}) {
16+
for range(from, to) { |i|
17+
f.x(i*2u); //! ERROR access to impure function prohibited
18+
}
19+
}
20+
21+
fn main() {}

0 commit comments

Comments
 (0)