Skip to content

Commit 2e2ea26

Browse files
committed
remove unused tcx argument
1 parent 5e2f337 commit 2e2ea26

File tree

3 files changed

+10
-15
lines changed

3 files changed

+10
-15
lines changed

src/librustc_mir/borrow_check/nll/escaping_locals.rs

+6-11
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@
4444
4545
use rustc::mir::visit::Visitor;
4646
use rustc::mir::*;
47-
use rustc::ty::TyCtxt;
4847

4948
use rustc_data_structures::indexed_vec::Idx;
5049
use rustc_data_structures::unify as ut;
@@ -54,8 +53,8 @@ crate struct EscapingLocals {
5453
}
5554

5655
impl EscapingLocals {
57-
crate fn compute(tcx: TyCtxt<'_, '_, 'tcx>, mir: &Mir<'tcx>) -> Self {
58-
let mut visitor = GatherAssignedLocalsVisitor::new(tcx, mir);
56+
crate fn compute(mir: &Mir<'tcx>) -> Self {
57+
let mut visitor = GatherAssignedLocalsVisitor::new();
5958
visitor.visit_mir(mir);
6059

6160
EscapingLocals {
@@ -74,10 +73,8 @@ impl EscapingLocals {
7473

7574
/// The MIR visitor gathering the union-find of the locals used in
7675
/// assignments.
77-
struct GatherAssignedLocalsVisitor<'cx, 'gcx: 'tcx, 'tcx: 'cx> {
76+
struct GatherAssignedLocalsVisitor {
7877
unification_table: ut::UnificationTable<ut::InPlace<AssignedLocal>>,
79-
tcx: TyCtxt<'cx, 'gcx, 'tcx>,
80-
mir: &'cx Mir<'tcx>,
8178
}
8279

8380
#[derive(Copy, Clone, Debug, Hash, PartialEq, Eq)]
@@ -107,12 +104,10 @@ impl From<Local> for AssignedLocal {
107104
}
108105
}
109106

110-
impl GatherAssignedLocalsVisitor<'cx, 'gcx, 'tcx> {
111-
fn new(tcx: TyCtxt<'cx, 'gcx, 'tcx>, mir: &'cx Mir<'tcx>) -> Self {
107+
impl GatherAssignedLocalsVisitor {
108+
fn new() -> Self {
112109
Self {
113110
unification_table: ut::UnificationTable::new(),
114-
tcx,
115-
mir,
116111
}
117112
}
118113

@@ -154,7 +149,7 @@ fn find_local_in_operand(op: &Operand) -> Option<Local> {
154149
}
155150
}
156151

157-
impl Visitor<'tcx> for GatherAssignedLocalsVisitor<'_, '_, 'tcx> {
152+
impl Visitor<'tcx> for GatherAssignedLocalsVisitor {
158153
fn visit_mir(&mut self, mir: &Mir<'tcx>) {
159154
// We need as many union-find keys as there are locals
160155
for _ in 0..mir.local_decls.len() {

src/librustc_mir/borrow_check/nll/liveness_map.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
1919
use borrow_check::nll::escaping_locals::EscapingLocals;
2020
use rustc::mir::{Local, Mir};
21-
use rustc::ty::{TyCtxt, TypeFoldable};
21+
use rustc::ty::TypeFoldable;
2222
use rustc_data_structures::indexed_vec::IndexVec;
2323
use util::liveness::LiveVariableMap;
2424

@@ -55,8 +55,8 @@ impl LiveVariableMap for NllLivenessMap {
5555
impl NllLivenessMap {
5656
/// Iterates over the variables in Mir and assigns each Local whose type contains
5757
/// regions a LocalWithRegion index. Returns a map for converting back and forth.
58-
crate fn compute(tcx: TyCtxt<'_, '_, 'tcx>, mir: &Mir<'tcx>) -> Self {
59-
let mut escaping_locals = EscapingLocals::compute(tcx, mir);
58+
crate fn compute(mir: &Mir<'tcx>) -> Self {
59+
let mut escaping_locals = EscapingLocals::compute(mir);
6060

6161
let mut to_local = IndexVec::default();
6262
let mut escapes_into_return = 0;

src/librustc_mir/borrow_check/nll/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ pub(in borrow_check) fn compute_regions<'cx, 'gcx, 'tcx>(
109109
let elements = &Rc::new(RegionValueElements::new(mir));
110110

111111
// Run the MIR type-checker.
112-
let liveness_map = NllLivenessMap::compute(infcx.tcx, &mir);
112+
let liveness_map = NllLivenessMap::compute(&mir);
113113
let liveness = LivenessResults::compute(mir, &liveness_map);
114114
let (constraint_sets, universal_region_relations) = type_check::type_check(
115115
infcx,

0 commit comments

Comments
 (0)