File tree Expand file tree Collapse file tree 3 files changed +23
-2
lines changed Expand file tree Collapse file tree 3 files changed +23
-2
lines changed Original file line number Diff line number Diff line change 2
2
refs/heads/master: 61b1875c16de39c166b0f4d54bba19f9c6777d1a
3
3
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4
4
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
5
- refs/heads/try: 653a1f8781cd4148d836915228ac28f13853457d
5
+ refs/heads/try: 79b3dedac3f50ec22d9fcab887f29d03ceec9406
6
6
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
Original file line number Diff line number Diff line change @@ -654,7 +654,7 @@ impl methods for check_loan_ctxt {
654
654
self . fn_args. contains( did. node) ;
655
655
if is_fn_arg { ret; } // case (a) above
656
656
}
657
- ast:: expr_fn_block( * ) | ast:: expr_fn( * ) {
657
+ ast:: expr_fn_block( * ) | ast:: expr_fn( * ) | ast :: expr_loop_body ( * ) {
658
658
if self . is_stack_closure( expr. id) { ret; } // case (b) above
659
659
}
660
660
_ { }
Original file line number Diff line number Diff line change
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 += 1 u;
6
+ }
7
+ }
8
+
9
+ pure fn range2 ( from : uint , to : uint , f : fn ( uint ) ) {
10
+ for range( from, to) { |i|
11
+ f ( i* 2 u) ;
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* 2 u) ; //! ERROR access to impure function prohibited
18
+ }
19
+ }
20
+
21
+ fn main ( ) { }
You can’t perform that action at this time.
0 commit comments