@@ -27,7 +27,6 @@ use middle::typeck::MethodCall;
2727use util:: common:: indenter;
2828use util:: ppaux:: { Repr } ;
2929
30- use std:: cell:: RefCell ;
3130use std:: vec_ng:: Vec ;
3231use syntax:: ast;
3332use syntax:: ast_util;
@@ -72,7 +71,7 @@ struct GatherLoanCtxt<'a> {
7271 bccx : & ' a BorrowckCtxt < ' a > ,
7372 id_range : IdRange ,
7473 move_data : move_data:: MoveData ,
75- all_loans : @ RefCell < Vec < Loan > > ,
74+ all_loans : Vec < Loan > ,
7675 item_ub : ast:: NodeId ,
7776 repeating_ids : Vec < ast:: NodeId > }
7877
@@ -104,19 +103,20 @@ impl<'a> visit::Visitor<()> for GatherLoanCtxt<'a> {
104103}
105104
106105pub 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 ) {
108107 let mut glcx = GatherLoanCtxt {
109108 bccx : bccx,
110109 id_range : IdRange :: max ( ) ,
111- all_loans : @ RefCell :: new ( Vec :: new ( ) ) ,
110+ all_loans : Vec :: new ( ) ,
112111 item_ub : body. id ,
113112 repeating_ids : vec ! ( body. id) ,
114113 move_data : MoveData :: new ( )
115114 } ;
116115 glcx. gather_fn_arg_patterns ( decl, body) ;
117116
118117 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)
120120}
121121
122122fn add_pat_to_id_range ( this : & mut GatherLoanCtxt ,
@@ -584,9 +584,8 @@ impl<'a> GatherLoanCtxt<'a> {
584584 self . mark_loan_path_as_mutated ( loan_path) ;
585585 }
586586
587- let all_loans = self . all_loans . borrow ( ) ;
588587 Loan {
589- index : all_loans . get ( ) . len ( ) ,
588+ index : self . all_loans . len ( ) ,
590589 loan_path : loan_path,
591590 cmt : cmt,
592591 kind : req_kind,
@@ -605,10 +604,7 @@ impl<'a> GatherLoanCtxt<'a> {
605604 // let loan_path = loan.loan_path;
606605 // let loan_gen_scope = loan.gen_scope;
607606 // 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) ;
612608
613609 // if loan_gen_scope != borrow_id {
614610 // FIXME(#6268) Nested method calls
0 commit comments