Skip to content

Commit 768630b

Browse files
committed
Auto merge of #29840 - gereeter:move-error-no-refcell, r=sanxiyn
2 parents 4f5edf9 + d842a54 commit 768630b

File tree

3 files changed

+12
-13
lines changed

3 files changed

+12
-13
lines changed

src/librustc_borrowck/borrowck/gather_loans/gather_moves.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ pub fn gather_decl<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>,
4444

4545
pub fn gather_move_from_expr<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>,
4646
move_data: &MoveData<'tcx>,
47-
move_error_collector: &MoveErrorCollector<'tcx>,
47+
move_error_collector: &mut MoveErrorCollector<'tcx>,
4848
move_expr_id: ast::NodeId,
4949
cmt: mc::cmt<'tcx>,
5050
move_reason: euv::MoveReason) {
@@ -63,7 +63,7 @@ pub fn gather_move_from_expr<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>,
6363

6464
pub fn gather_match_variant<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>,
6565
move_data: &MoveData<'tcx>,
66-
_move_error_collector: &MoveErrorCollector<'tcx>,
66+
_move_error_collector: &mut MoveErrorCollector<'tcx>,
6767
move_pat: &hir::Pat,
6868
cmt: mc::cmt<'tcx>,
6969
mode: euv::MatchMode) {
@@ -94,7 +94,7 @@ pub fn gather_match_variant<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>,
9494

9595
pub fn gather_move_from_pat<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>,
9696
move_data: &MoveData<'tcx>,
97-
move_error_collector: &MoveErrorCollector<'tcx>,
97+
move_error_collector: &mut MoveErrorCollector<'tcx>,
9898
move_pat: &hir::Pat,
9999
cmt: mc::cmt<'tcx>) {
100100
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>,
115115

116116
fn gather_move<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>,
117117
move_data: &MoveData<'tcx>,
118-
move_error_collector: &MoveErrorCollector<'tcx>,
118+
move_error_collector: &mut MoveErrorCollector<'tcx>,
119119
move_info: GatherMoveInfo<'tcx>) {
120120
debug!("gather_move(move_id={}, cmt={:?})",
121121
move_info.id, move_info.cmt);

src/librustc_borrowck/borrowck/gather_loans/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ impl<'a, 'tcx> euv::Delegate<'tcx> for GatherLoanCtxt<'a, 'tcx> {
8686
match mode {
8787
euv::Move(move_reason) => {
8888
gather_moves::gather_move_from_expr(
89-
self.bccx, &self.move_data, &self.move_error_collector,
89+
self.bccx, &self.move_data, &mut self.move_error_collector,
9090
consume_id, cmt, move_reason);
9191
}
9292
euv::Copy => { }
@@ -104,7 +104,7 @@ impl<'a, 'tcx> euv::Delegate<'tcx> for GatherLoanCtxt<'a, 'tcx> {
104104

105105
if let Categorization::Downcast(..) = cmt.cat {
106106
gather_moves::gather_match_variant(
107-
self.bccx, &self.move_data, &self.move_error_collector,
107+
self.bccx, &self.move_data, &mut self.move_error_collector,
108108
matched_pat, cmt, mode);
109109
}
110110
}
@@ -124,7 +124,7 @@ impl<'a, 'tcx> euv::Delegate<'tcx> for GatherLoanCtxt<'a, 'tcx> {
124124
}
125125

126126
gather_moves::gather_move_from_pat(
127-
self.bccx, &self.move_data, &self.move_error_collector,
127+
self.bccx, &self.move_data, &mut self.move_error_collector,
128128
consume_pat, cmt);
129129
}
130130

src/librustc_borrowck/borrowck/gather_loans/move_error.rs

+5-6
Original file line numberDiff line numberDiff line change
@@ -13,28 +13,27 @@ use rustc::middle::mem_categorization as mc;
1313
use rustc::middle::mem_categorization::Categorization;
1414
use rustc::middle::mem_categorization::InteriorOffsetKind as Kind;
1515
use rustc::middle::ty;
16-
use std::cell::RefCell;
1716
use syntax::ast;
1817
use syntax::codemap;
1918
use rustc_front::hir;
2019

2120
pub struct MoveErrorCollector<'tcx> {
22-
errors: RefCell<Vec<MoveError<'tcx>>>
21+
errors: Vec<MoveError<'tcx>>
2322
}
2423

2524
impl<'tcx> MoveErrorCollector<'tcx> {
2625
pub fn new() -> MoveErrorCollector<'tcx> {
2726
MoveErrorCollector {
28-
errors: RefCell::new(Vec::new())
27+
errors: Vec::new()
2928
}
3029
}
3130

32-
pub fn add_error(&self, error: MoveError<'tcx>) {
33-
self.errors.borrow_mut().push(error);
31+
pub fn add_error(&mut self, error: MoveError<'tcx>) {
32+
self.errors.push(error);
3433
}
3534

3635
pub fn report_potential_errors<'a>(&self, bccx: &BorrowckCtxt<'a, 'tcx>) {
37-
report_move_errors(bccx, &*self.errors.borrow())
36+
report_move_errors(bccx, &self.errors)
3837
}
3938
}
4039

0 commit comments

Comments
 (0)