Remove root_local fn in favor of base_local
This commit is contained in:
parent
a0f4914ccb
commit
9f7b953a7e
2 changed files with 2 additions and 17 deletions
|
@ -210,7 +210,7 @@ impl<'a, 'gcx, 'tcx> Visitor<'tcx> for GatherBorrows<'a, 'gcx, 'tcx> {
|
|||
|
||||
self.insert_as_pending_if_two_phase(location, &assigned_place, kind, idx);
|
||||
|
||||
if let Some(local) = borrowed_place.root_local() {
|
||||
if let Some(local) = borrowed_place.base_local() {
|
||||
self.local_map.entry(local).or_default().insert(idx);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use rustc::hir;
|
||||
use rustc::mir::ProjectionElem;
|
||||
use rustc::mir::{Local, Mir, Place, PlaceBase, Mutability, Static, StaticKind};
|
||||
use rustc::mir::{Mir, Place, PlaceBase, Mutability, Static, StaticKind};
|
||||
use rustc::ty::{self, TyCtxt};
|
||||
use crate::borrow_check::borrow_set::LocalsStateAtExit;
|
||||
|
||||
|
@ -16,10 +16,6 @@ crate trait PlaceExt<'tcx> {
|
|||
mir: &Mir<'tcx>,
|
||||
locals_state_at_exit: &LocalsStateAtExit,
|
||||
) -> bool;
|
||||
|
||||
/// If this is a place like `x.f.g`, returns the local
|
||||
/// `x`. Returns `None` if this is based in a static.
|
||||
fn root_local(&self) -> Option<Local>;
|
||||
}
|
||||
|
||||
impl<'tcx> PlaceExt<'tcx> for Place<'tcx> {
|
||||
|
@ -82,15 +78,4 @@ impl<'tcx> PlaceExt<'tcx> for Place<'tcx> {
|
|||
},
|
||||
}
|
||||
}
|
||||
|
||||
fn root_local(&self) -> Option<Local> {
|
||||
let mut p = self;
|
||||
loop {
|
||||
match p {
|
||||
Place::Projection(pi) => p = &pi.base,
|
||||
Place::Base(PlaceBase::Static(_)) => return None,
|
||||
Place::Base(PlaceBase::Local(l)) => return Some(*l),
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue