@@ -27,7 +27,6 @@ use middle::typeck::MethodCall;
27
27
use util:: common:: indenter;
28
28
use util:: ppaux:: { Repr } ;
29
29
30
- use std:: cell:: RefCell ;
31
30
use std:: vec_ng:: Vec ;
32
31
use syntax:: ast;
33
32
use syntax:: ast_util;
@@ -72,7 +71,7 @@ struct GatherLoanCtxt<'a> {
72
71
bccx : & ' a BorrowckCtxt < ' a > ,
73
72
id_range : IdRange ,
74
73
move_data : move_data:: MoveData ,
75
- all_loans : @ RefCell < Vec < Loan > > ,
74
+ all_loans : Vec < Loan > ,
76
75
item_ub : ast:: NodeId ,
77
76
repeating_ids : Vec < ast:: NodeId > }
78
77
@@ -104,19 +103,20 @@ impl<'a> visit::Visitor<()> for GatherLoanCtxt<'a> {
104
103
}
105
104
106
105
pub fn gather_loans ( bccx : & BorrowckCtxt , decl : & ast:: FnDecl , body : & ast:: Block )
107
- -> ( IdRange , @ RefCell < Vec < Loan > > , move_data:: MoveData ) {
106
+ -> ( IdRange , Vec < Loan > , move_data:: MoveData ) {
108
107
let mut glcx = GatherLoanCtxt {
109
108
bccx : bccx,
110
109
id_range : IdRange :: max ( ) ,
111
- all_loans : @ RefCell :: new ( Vec :: new ( ) ) ,
110
+ all_loans : Vec :: new ( ) ,
112
111
item_ub : body. id ,
113
112
repeating_ids : vec ! ( body. id) ,
114
113
move_data : MoveData :: new ( )
115
114
} ;
116
115
glcx. gather_fn_arg_patterns ( decl, body) ;
117
116
118
117
glcx. visit_block ( body, ( ) ) ;
119
- return ( glcx. id_range , glcx. all_loans , glcx. move_data ) ;
118
+ let GatherLoanCtxt { id_range, all_loans, move_data, .. } = glcx;
119
+ ( id_range, all_loans, move_data)
120
120
}
121
121
122
122
fn add_pat_to_id_range ( this : & mut GatherLoanCtxt ,
@@ -584,9 +584,8 @@ impl<'a> GatherLoanCtxt<'a> {
584
584
self . mark_loan_path_as_mutated ( loan_path) ;
585
585
}
586
586
587
- let all_loans = self . all_loans . borrow ( ) ;
588
587
Loan {
589
- index : all_loans . get ( ) . len ( ) ,
588
+ index : self . all_loans . len ( ) ,
590
589
loan_path : loan_path,
591
590
cmt : cmt,
592
591
kind : req_kind,
@@ -605,10 +604,7 @@ impl<'a> GatherLoanCtxt<'a> {
605
604
// let loan_path = loan.loan_path;
606
605
// let loan_gen_scope = loan.gen_scope;
607
606
// let loan_kill_scope = loan.kill_scope;
608
- {
609
- let mut all_loans = self . all_loans . borrow_mut ( ) ;
610
- all_loans. get ( ) . push ( loan) ;
611
- }
607
+ self . all_loans . push ( loan) ;
612
608
613
609
// if loan_gen_scope != borrow_id {
614
610
// FIXME(#6268) Nested method calls
0 commit comments