use rustc::mir::visit::Visitor;
use rustc::mir::*;
-use rustc::ty::TyCtxt;
use rustc_data_structures::indexed_vec::Idx;
use rustc_data_structures::unify as ut;
}
impl EscapingLocals {
- crate fn compute(tcx: TyCtxt<'_, '_, 'tcx>, mir: &Mir<'tcx>) -> Self {
- let mut visitor = GatherAssignedLocalsVisitor::new(tcx, mir);
+ crate fn compute(mir: &Mir<'tcx>) -> Self {
+ let mut visitor = GatherAssignedLocalsVisitor::new();
visitor.visit_mir(mir);
EscapingLocals {
/// The MIR visitor gathering the union-find of the locals used in
/// assignments.
-struct GatherAssignedLocalsVisitor<'cx, 'gcx: 'tcx, 'tcx: 'cx> {
+struct GatherAssignedLocalsVisitor {
unification_table: ut::UnificationTable<ut::InPlace<AssignedLocal>>,
- tcx: TyCtxt<'cx, 'gcx, 'tcx>,
- mir: &'cx Mir<'tcx>,
}
#[derive(Copy, Clone, Debug, Hash, PartialEq, Eq)]
}
}
-impl GatherAssignedLocalsVisitor<'cx, 'gcx, 'tcx> {
- fn new(tcx: TyCtxt<'cx, 'gcx, 'tcx>, mir: &'cx Mir<'tcx>) -> Self {
+impl GatherAssignedLocalsVisitor {
+ fn new() -> Self {
Self {
unification_table: ut::UnificationTable::new(),
- tcx,
- mir,
}
}
}
}
-impl Visitor<'tcx> for GatherAssignedLocalsVisitor<'_, '_, 'tcx> {
+impl Visitor<'tcx> for GatherAssignedLocalsVisitor {
fn visit_mir(&mut self, mir: &Mir<'tcx>) {
// We need as many union-find keys as there are locals
for _ in 0..mir.local_decls.len() {
use borrow_check::nll::escaping_locals::EscapingLocals;
use rustc::mir::{Local, Mir};
-use rustc::ty::{TyCtxt, TypeFoldable};
+use rustc::ty::TypeFoldable;
use rustc_data_structures::indexed_vec::IndexVec;
use util::liveness::LiveVariableMap;
impl NllLivenessMap {
/// Iterates over the variables in Mir and assigns each Local whose type contains
/// regions a LocalWithRegion index. Returns a map for converting back and forth.
- crate fn compute(tcx: TyCtxt<'_, '_, 'tcx>, mir: &Mir<'tcx>) -> Self {
- let mut escaping_locals = EscapingLocals::compute(tcx, mir);
+ crate fn compute(mir: &Mir<'tcx>) -> Self {
+ let mut escaping_locals = EscapingLocals::compute(mir);
let mut to_local = IndexVec::default();
let mut escapes_into_return = 0;
let elements = &Rc::new(RegionValueElements::new(mir));
// Run the MIR type-checker.
- let liveness_map = NllLivenessMap::compute(infcx.tcx, &mir);
+ let liveness_map = NllLivenessMap::compute(&mir);
let liveness = LivenessResults::compute(mir, &liveness_map);
let (constraint_sets, universal_region_relations) = type_check::type_check(
infcx,