Skip to content

Commit 8592039

Browse files
Remove dead code
1 parent f390917 commit 8592039

File tree

6 files changed

+16
-67
lines changed

6 files changed

+16
-67
lines changed

src/librustc_borrowck/borrowck/check_loans.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ struct CheckLoanCtxt<'a, 'tcx: 'a> {
9191
dfcx_loans: &'a LoanDataFlow<'a, 'tcx>,
9292
move_data: &'a move_data::FlowedMoveData<'a, 'tcx>,
9393
all_loans: &'a [Loan<'tcx>],
94-
param_env: ty::ParamEnv<'tcx>,
9594
movable_generator: bool,
9695
}
9796

@@ -215,7 +214,6 @@ pub fn check_loans<'a, 'b, 'c, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>,
215214
dfcx_loans,
216215
move_data,
217216
all_loans,
218-
param_env,
219217
movable_generator,
220218
};
221219
let rvalue_promotable_map = bccx.tcx.rvalue_promotable_map(def_id);
@@ -801,8 +799,7 @@ impl<'a, 'tcx> CheckLoanCtxt<'a, 'tcx> {
801799
use_kind,
802800
&lp,
803801
the_move,
804-
moved_lp,
805-
self.param_env);
802+
moved_lp);
806803
false
807804
});
808805
}

src/librustc_borrowck/borrowck/gather_loans/gather_moves.rs

+2-6
Original file line numberDiff line numberDiff line change
@@ -163,15 +163,11 @@ pub fn gather_assignment<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>,
163163
move_data: &MoveData<'tcx>,
164164
assignment_id: hir::ItemLocalId,
165165
assignment_span: Span,
166-
assignee_loan_path: Rc<LoanPath<'tcx>>,
167-
assignee_id: hir::ItemLocalId,
168-
mode: euv::MutateMode) {
166+
assignee_loan_path: Rc<LoanPath<'tcx>>) {
169167
move_data.add_assignment(bccx.tcx,
170168
assignee_loan_path,
171169
assignment_id,
172-
assignment_span,
173-
assignee_id,
174-
mode);
170+
assignment_span);
175171
}
176172

177173
// (keep in sync with move_error::report_cannot_move_out_of )

src/librustc_borrowck/borrowck/gather_loans/lifetime.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@ pub fn guarantee_lifetime<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>,
2828
span: Span,
2929
cause: euv::LoanCause,
3030
cmt: &'a mc::cmt_<'tcx>,
31-
loan_region: ty::Region<'tcx>,
32-
_: ty::BorrowKind)
31+
loan_region: ty::Region<'tcx>)
3332
-> Result<(),()> {
3433
//! Reports error if `loan_region` is larger than S
3534
//! where S is `item_scope` if `cmt` is an upvar,

src/librustc_borrowck/borrowck/gather_loans/mod.rs

+5-9
Original file line numberDiff line numberDiff line change
@@ -145,12 +145,11 @@ impl<'a, 'tcx> euv::Delegate<'tcx> for GatherLoanCtxt<'a, 'tcx> {
145145
assignment_id: ast::NodeId,
146146
assignment_span: Span,
147147
assignee_cmt: &mc::cmt_<'tcx>,
148-
mode: euv::MutateMode)
148+
_: euv::MutateMode)
149149
{
150150
self.guarantee_assignment_valid(assignment_id,
151151
assignment_span,
152-
assignee_cmt,
153-
mode);
152+
assignee_cmt);
154153
}
155154

156155
fn decl_without_init(&mut self, id: ast::NodeId, _span: Span) {
@@ -246,8 +245,7 @@ impl<'a, 'tcx> GatherLoanCtxt<'a, 'tcx> {
246245
fn guarantee_assignment_valid(&mut self,
247246
assignment_id: ast::NodeId,
248247
assignment_span: Span,
249-
cmt: &mc::cmt_<'tcx>,
250-
mode: euv::MutateMode) {
248+
cmt: &mc::cmt_<'tcx>) {
251249

252250
let opt_lp = opt_loan_path(cmt);
253251
debug!("guarantee_assignment_valid(assignment_id={}, cmt={:?}) opt_lp={:?}",
@@ -282,9 +280,7 @@ impl<'a, 'tcx> GatherLoanCtxt<'a, 'tcx> {
282280
self.bccx.tcx.hir.node_to_hir_id(assignment_id)
283281
.local_id,
284282
assignment_span,
285-
lp,
286-
cmt.hir_id.local_id,
287-
mode);
283+
lp);
288284
}
289285
None => {
290286
// This can occur with e.g. `*foo() = 5`. In such
@@ -320,7 +316,7 @@ impl<'a, 'tcx> GatherLoanCtxt<'a, 'tcx> {
320316
// Check that the lifetime of the borrow does not exceed
321317
// the lifetime of the data being borrowed.
322318
if lifetime::guarantee_lifetime(self.bccx, self.item_ub,
323-
borrow_span, cause, cmt, loan_region, req_kind).is_err() {
319+
borrow_span, cause, cmt, loan_region).is_err() {
324320
return; // reported an error, no sense in reporting more.
325321
}
326322

src/librustc_borrowck/borrowck/mod.rs

+1-19
Original file line numberDiff line numberDiff line change
@@ -638,8 +638,7 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
638638
use_kind: MovedValueUseKind,
639639
lp: &LoanPath<'tcx>,
640640
the_move: &move_data::Move,
641-
moved_lp: &LoanPath<'tcx>,
642-
_param_env: ty::ParamEnv<'tcx>) {
641+
moved_lp: &LoanPath<'tcx>) {
643642
let (verb, verb_participle) = match use_kind {
644643
MovedInUse => ("use", "used"),
645644
MovedInCapture => ("capture", "captured"),
@@ -804,23 +803,6 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
804803
self.signal_error();
805804
}
806805

807-
pub fn struct_span_err_with_code<S: Into<MultiSpan>>(&self,
808-
s: S,
809-
msg: &str,
810-
code: DiagnosticId)
811-
-> DiagnosticBuilder<'a> {
812-
self.tcx.sess.struct_span_err_with_code(s, msg, code)
813-
}
814-
815-
pub fn span_err_with_code<S: Into<MultiSpan>>(
816-
&self,
817-
s: S,
818-
msg: &str,
819-
code: DiagnosticId,
820-
) {
821-
self.tcx.sess.span_err_with_code(s, msg, code);
822-
}
823-
824806
fn report_bckerr(&self, err: &BckError<'a, 'tcx>) {
825807
let error_span = err.span.clone();
826808

src/librustc_borrowck/borrowck/move_data.rs

+6-27
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,8 @@ use dataflow::{DataFlowContext, BitwiseOperator, DataFlowOperator, KillFrom};
1717

1818
use borrowck::*;
1919
use rustc::cfg;
20-
use rustc::middle::expr_use_visitor as euv;
21-
use rustc::middle::expr_use_visitor::MutateMode;
2220
use rustc::ty::{self, TyCtxt};
23-
use rustc::util::nodemap::{FxHashMap, FxHashSet};
21+
use rustc::util::nodemap::FxHashMap;
2422

2523
use std::cell::RefCell;
2624
use std::rc::Rc;
@@ -49,9 +47,6 @@ pub struct MoveData<'tcx> {
4947
/// assigned dataflow bits, but we track them because they still
5048
/// kill move bits.
5149
pub path_assignments: RefCell<Vec<Assignment>>,
52-
53-
/// Assignments to a variable or path, like `x = foo`, but not `x += foo`.
54-
pub assignee_ids: RefCell<FxHashSet<hir::ItemLocalId>>,
5550
}
5651

5752
pub struct FlowedMoveData<'a, 'tcx: 'a> {
@@ -149,9 +144,6 @@ pub struct Assignment {
149144

150145
/// span of node where assignment occurs
151146
pub span: Span,
152-
153-
/// id for place expression on lhs of assignment
154-
pub assignee_id: hir::ItemLocalId,
155147
}
156148

157149
#[derive(Clone, Copy)]
@@ -386,9 +378,7 @@ impl<'a, 'tcx> MoveData<'tcx> {
386378
pub fn add_assignment(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>,
387379
lp: Rc<LoanPath<'tcx>>,
388380
assign_id: hir::ItemLocalId,
389-
span: Span,
390-
assignee_id: hir::ItemLocalId,
391-
mode: euv::MutateMode) {
381+
span: Span) {
392382
// Assigning to one union field automatically assigns to all its fields.
393383
if let LpExtend(ref base_lp, mutbl, LpInterior(opt_variant_id, interior)) = lp.kind {
394384
if let ty::TyAdt(adt_def, _) = base_lp.ty.sty {
@@ -405,39 +395,28 @@ impl<'a, 'tcx> MoveData<'tcx> {
405395
LpInterior(opt_variant_id, field));
406396
let sibling_lp = Rc::new(LoanPath::new(sibling_lp_kind, field_ty));
407397
self.add_assignment_helper(tcx, sibling_lp, assign_id,
408-
span, assignee_id, mode);
398+
span);
409399
}
410400
return;
411401
}
412402
}
413403
}
414404

415-
self.add_assignment_helper(tcx, lp.clone(), assign_id, span, assignee_id, mode);
405+
self.add_assignment_helper(tcx, lp.clone(), assign_id, span);
416406
}
417407

418408
fn add_assignment_helper(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>,
419409
lp: Rc<LoanPath<'tcx>>,
420410
assign_id: hir::ItemLocalId,
421-
span: Span,
422-
assignee_id: hir::ItemLocalId,
423-
mode: euv::MutateMode) {
424-
debug!("add_assignment(lp={:?}, assign_id={:?}, assignee_id={:?}",
425-
lp, assign_id, assignee_id);
411+
span: Span) {
412+
debug!("add_assignment(lp={:?}, assign_id={:?}", lp, assign_id);
426413

427414
let path_index = self.move_path(tcx, lp.clone());
428415

429-
match mode {
430-
MutateMode::Init | MutateMode::JustWrite => {
431-
self.assignee_ids.borrow_mut().insert(assignee_id);
432-
}
433-
MutateMode::WriteAndRead => { }
434-
}
435-
436416
let assignment = Assignment {
437417
path: path_index,
438418
id: assign_id,
439419
span,
440-
assignee_id,
441420
};
442421

443422
if self.is_var_path(path_index) {

0 commit comments

Comments
 (0)