@@ -31,10 +31,11 @@ use syntax::codemap::span;
31
31
use syntax:: visit;
32
32
use util:: ppaux:: Repr ;
33
33
34
+ #[ deriving( Clone ) ]
34
35
struct CheckLoanCtxt < ' self > {
35
36
bccx : @BorrowckCtxt ,
36
37
dfcx_loans : & ' self LoanDataFlow ,
37
- move_data : move_data:: FlowedMoveData ,
38
+ move_data : @ move_data:: FlowedMoveData ,
38
39
all_loans : & ' self [ Loan ] ,
39
40
reported : @mut HashSet < ast:: node_id > ,
40
41
}
@@ -46,10 +47,10 @@ pub fn check_loans(bccx: @BorrowckCtxt,
46
47
body : & ast:: blk ) {
47
48
debug ! ( "check_loans(body id=%?)" , body. id) ;
48
49
49
- let clcx = @ mut CheckLoanCtxt {
50
+ let clcx = CheckLoanCtxt {
50
51
bccx : bccx,
51
52
dfcx_loans : dfcx_loans,
52
- move_data : move_data,
53
+ move_data : @ move_data,
53
54
all_loans : all_loans,
54
55
reported : @mut HashSet :: new ( ) ,
55
56
} ;
@@ -139,7 +140,7 @@ impl<'self> CheckLoanCtxt<'self> {
139
140
return result;
140
141
}
141
142
142
- pub fn check_for_conflicting_loans( & mut self , scope_id: ast:: node_id) {
143
+ pub fn check_for_conflicting_loans( & self , scope_id: ast:: node_id) {
143
144
//! Checks to see whether any of the loans that are issued
144
145
//! by `scope_id` conflict with loans that have already been
145
146
//! issued when we enter `scope_id` (for example, we do not
@@ -596,7 +597,7 @@ impl<'self> CheckLoanCtxt<'self> {
596
597
MoveOk
597
598
}
598
599
599
- pub fn check_call( & mut self ,
600
+ pub fn check_call( & self ,
600
601
_expr: @ast:: expr,
601
602
_callee: Option <@ast:: expr>,
602
603
_callee_id: ast:: node_id,
@@ -617,8 +618,8 @@ fn check_loans_in_fn<'a>(fk: &visit::fn_kind,
617
618
body: & ast:: blk,
618
619
sp: span,
619
620
id: ast:: node_id,
620
- ( this, visitor) : ( @ mut CheckLoanCtxt <' a>,
621
- visit:: vt<@ mut CheckLoanCtxt <' a>>) ) {
621
+ ( this, visitor) : ( CheckLoanCtxt <' a>,
622
+ visit:: vt<CheckLoanCtxt <' a>>) ) {
622
623
match * fk {
623
624
visit:: fk_item_fn( * ) |
624
625
visit:: fk_method( * ) => {
@@ -634,7 +635,7 @@ fn check_loans_in_fn<'a>(fk: &visit::fn_kind,
634
635
635
636
visit:: visit_fn( fk, decl, body, sp, id, ( this, visitor) ) ;
636
637
637
- fn check_captured_variables( this: @ mut CheckLoanCtxt ,
638
+ fn check_captured_variables( this: CheckLoanCtxt ,
638
639
closure_id: ast:: node_id,
639
640
span: span) {
640
641
let cap_vars = this. bccx. capture_map. get( & closure_id) ;
@@ -652,7 +653,7 @@ fn check_loans_in_fn<'a>(fk: &visit::fn_kind,
652
653
}
653
654
return ;
654
655
655
- fn check_by_move_capture( this: @ mut CheckLoanCtxt ,
656
+ fn check_by_move_capture( this: CheckLoanCtxt ,
656
657
closure_id: ast:: node_id,
657
658
cap_var: & moves:: CaptureVar ,
658
659
move_path: @LoanPath ) {
@@ -676,14 +677,14 @@ fn check_loans_in_fn<'a>(fk: &visit::fn_kind,
676
677
}
677
678
678
679
fn check_loans_in_local<' a>( local: @ast:: local,
679
- ( this, vt) : ( @ mut CheckLoanCtxt <' a>,
680
- visit:: vt<@ mut CheckLoanCtxt <' a>>) ) {
680
+ ( this, vt) : ( CheckLoanCtxt <' a>,
681
+ visit:: vt<CheckLoanCtxt <' a>>) ) {
681
682
visit:: visit_local( local, ( this, vt) ) ;
682
683
}
683
684
684
685
fn check_loans_in_expr<' a>( expr: @ast:: expr,
685
- ( this, vt) : ( @ mut CheckLoanCtxt <' a>,
686
- visit:: vt<@ mut CheckLoanCtxt <' a>>) ) {
686
+ ( this, vt) : ( CheckLoanCtxt <' a>,
687
+ visit:: vt<CheckLoanCtxt <' a>>) ) {
687
688
visit:: visit_expr( expr, ( this, vt) ) ;
688
689
689
690
debug!( "check_loans_in_expr( expr=%s) ",
@@ -736,17 +737,17 @@ fn check_loans_in_expr<'a>(expr: @ast::expr,
736
737
}
737
738
738
739
fn check_loans_in_pat<' a>( pat: @ast:: pat,
739
- ( this, vt) : ( @ mut CheckLoanCtxt <' a>,
740
- visit:: vt<@ mut CheckLoanCtxt <' a>>) )
740
+ ( this, vt) : ( CheckLoanCtxt <' a>,
741
+ visit:: vt<CheckLoanCtxt <' a>>) )
741
742
{
742
743
this. check_for_conflicting_loans( pat. id) ;
743
744
this. check_move_out_from_id( pat. id, pat. span) ;
744
745
visit:: visit_pat( pat, ( this, vt) ) ;
745
746
}
746
747
747
748
fn check_loans_in_block<' a>( blk: & ast:: blk,
748
- ( this, vt) : ( @ mut CheckLoanCtxt <' a>,
749
- visit:: vt<@ mut CheckLoanCtxt <' a>>) )
749
+ ( this, vt) : ( CheckLoanCtxt <' a>,
750
+ visit:: vt<CheckLoanCtxt <' a>>) )
750
751
{
751
752
visit:: visit_block( blk, ( this, vt) ) ;
752
753
this. check_for_conflicting_loans( blk. id) ;
0 commit comments