Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/librustc_borrowck/borrowck/gather_loans/gather_moves.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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) {
Expand Down Expand Up @@ -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 {
Expand All @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions src/librustc_borrowck/borrowck/gather_loans/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 => { }
Expand All @@ -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);
}
}
Expand All @@ -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);
}

Expand Down
11 changes: 5 additions & 6 deletions src/librustc_borrowck/borrowck/gather_loans/move_error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}

Expand Down