diff --git a/src/librustc_borrowck/borrowck/gather_loans/gather_moves.rs b/src/librustc_borrowck/borrowck/gather_loans/gather_moves.rs index cf9de56c8dbf7..90c9361623252 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 99e4bb60aff28..de0b1fddc2006 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 fb703a9f9bca5..a56a03174f609 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>> + errors: Vec> } 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) } }