File tree Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Expand file tree Collapse file tree 2 files changed +22
-1
lines changed 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