about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJonathan S <gereeter+code@gmail.com>2015-11-14 17:23:31 -0600
committerJonathan S <gereeter+code@gmail.com>2015-11-14 17:39:15 -0600
commitd842a54b25fc015b1c81b8e20a8fa7c61dccf3d9 (patch)
tree94956267f42235e18229902abb19ebb3791d0cc2
parent4f5edf9e386f9ee7ed3f34edbaa3b71bd574c207 (diff)
downloadrust-d842a54b25fc015b1c81b8e20a8fa7c61dccf3d9.tar.gz
rust-d842a54b25fc015b1c81b8e20a8fa7c61dccf3d9.zip
Stop using dynamic borrowing in MoveErrorCollector
-rw-r--r--src/librustc_borrowck/borrowck/gather_loans/gather_moves.rs8
-rw-r--r--src/librustc_borrowck/borrowck/gather_loans/mod.rs6
-rw-r--r--src/librustc_borrowck/borrowck/gather_loans/move_error.rs11
3 files changed, 12 insertions, 13 deletions
diff --git a/src/librustc_borrowck/borrowck/gather_loans/gather_moves.rs b/src/librustc_borrowck/borrowck/gather_loans/gather_moves.rs
index cf9de56c8db..90c93616232 100644
--- a/src/librustc_borrowck/borrowck/gather_loans/gather_moves.rs
+++ b/src/librustc_borrowck/borrowck/gather_loans/gather_moves.rs
@@ -44,7 +44,7 @@ pub fn gather_decl<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>,
 
 pub fn gather_move_from_expr<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>,
                                        move_data: &MoveData<'tcx>,
-                                       move_error_collector: &MoveErrorCollector<'tcx>,
+                                       move_error_collector: &mut MoveErrorCollector<'tcx>,
                                        move_expr_id: ast::NodeId,
                                        cmt: mc::cmt<'tcx>,
                                        move_reason: euv::MoveReason) {
@@ -63,7 +63,7 @@ pub fn gather_move_from_expr<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>,
 
 pub fn gather_match_variant<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>,
                                       move_data: &MoveData<'tcx>,
-                                      _move_error_collector: &MoveErrorCollector<'tcx>,
+                                      _move_error_collector: &mut MoveErrorCollector<'tcx>,
                                       move_pat: &hir::Pat,
                                       cmt: mc::cmt<'tcx>,
                                       mode: euv::MatchMode) {
@@ -94,7 +94,7 @@ pub fn gather_match_variant<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>,
 
 pub fn gather_move_from_pat<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>,
                                       move_data: &MoveData<'tcx>,
-                                      move_error_collector: &MoveErrorCollector<'tcx>,
+                                      move_error_collector: &mut MoveErrorCollector<'tcx>,
                                       move_pat: &hir::Pat,
                                       cmt: mc::cmt<'tcx>) {
     let pat_span_path_opt = match move_pat.node {
@@ -115,7 +115,7 @@ pub fn gather_move_from_pat<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>,
 
 fn gather_move<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>,
                          move_data: &MoveData<'tcx>,
-                         move_error_collector: &MoveErrorCollector<'tcx>,
+                         move_error_collector: &mut MoveErrorCollector<'tcx>,
                          move_info: GatherMoveInfo<'tcx>) {
     debug!("gather_move(move_id={}, cmt={:?})",
            move_info.id, move_info.cmt);
diff --git a/src/librustc_borrowck/borrowck/gather_loans/mod.rs b/src/librustc_borrowck/borrowck/gather_loans/mod.rs
index 99e4bb60aff..de0b1fddc20 100644
--- a/src/librustc_borrowck/borrowck/gather_loans/mod.rs
+++ b/src/librustc_borrowck/borrowck/gather_loans/mod.rs
@@ -86,7 +86,7 @@ impl<'a, 'tcx> euv::Delegate<'tcx> for GatherLoanCtxt<'a, 'tcx> {
         match mode {
             euv::Move(move_reason) => {
                 gather_moves::gather_move_from_expr(
-                    self.bccx, &self.move_data, &self.move_error_collector,
+                    self.bccx, &self.move_data, &mut self.move_error_collector,
                     consume_id, cmt, move_reason);
             }
             euv::Copy => { }
@@ -104,7 +104,7 @@ impl<'a, 'tcx> euv::Delegate<'tcx> for GatherLoanCtxt<'a, 'tcx> {
 
         if let Categorization::Downcast(..) = cmt.cat {
             gather_moves::gather_match_variant(
-                self.bccx, &self.move_data, &self.move_error_collector,
+                self.bccx, &self.move_data, &mut self.move_error_collector,
                 matched_pat, cmt, mode);
         }
     }
@@ -124,7 +124,7 @@ impl<'a, 'tcx> euv::Delegate<'tcx> for GatherLoanCtxt<'a, 'tcx> {
         }
 
         gather_moves::gather_move_from_pat(
-            self.bccx, &self.move_data, &self.move_error_collector,
+            self.bccx, &self.move_data, &mut self.move_error_collector,
             consume_pat, cmt);
     }
 
diff --git a/src/librustc_borrowck/borrowck/gather_loans/move_error.rs b/src/librustc_borrowck/borrowck/gather_loans/move_error.rs
index fb703a9f9bc..a56a03174f6 100644
--- a/src/librustc_borrowck/borrowck/gather_loans/move_error.rs
+++ b/src/librustc_borrowck/borrowck/gather_loans/move_error.rs
@@ -13,28 +13,27 @@ use rustc::middle::mem_categorization as mc;
 use rustc::middle::mem_categorization::Categorization;
 use rustc::middle::mem_categorization::InteriorOffsetKind as Kind;
 use rustc::middle::ty;
-use std::cell::RefCell;
 use syntax::ast;
 use syntax::codemap;
 use rustc_front::hir;
 
 pub struct MoveErrorCollector<'tcx> {
-    errors: RefCell<Vec<MoveError<'tcx>>>
+    errors: Vec<MoveError<'tcx>>
 }
 
 impl<'tcx> MoveErrorCollector<'tcx> {
     pub fn new() -> MoveErrorCollector<'tcx> {
         MoveErrorCollector {
-            errors: RefCell::new(Vec::new())
+            errors: Vec::new()
         }
     }
 
-    pub fn add_error(&self, error: MoveError<'tcx>) {
-        self.errors.borrow_mut().push(error);
+    pub fn add_error(&mut self, error: MoveError<'tcx>) {
+        self.errors.push(error);
     }
 
     pub fn report_potential_errors<'a>(&self, bccx: &BorrowckCtxt<'a, 'tcx>) {
-        report_move_errors(bccx, &*self.errors.borrow())
+        report_move_errors(bccx, &self.errors)
     }
 }