Skip to content

Commit 9f7b953

Browse files
committed
Remove root_local fn in favor of base_local
1 parent a0f4914 commit 9f7b953

File tree

2 files changed

+2
-17
lines changed

2 files changed

+2
-17
lines changed

src/librustc_mir/borrow_check/borrow_set.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ impl<'a, 'gcx, 'tcx> Visitor<'tcx> for GatherBorrows<'a, 'gcx, 'tcx> {
210210

211211
self.insert_as_pending_if_two_phase(location, &assigned_place, kind, idx);
212212

213-
if let Some(local) = borrowed_place.root_local() {
213+
if let Some(local) = borrowed_place.base_local() {
214214
self.local_map.entry(local).or_default().insert(idx);
215215
}
216216
}

src/librustc_mir/borrow_check/place_ext.rs

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use rustc::hir;
22
use rustc::mir::ProjectionElem;
3-
use rustc::mir::{Local, Mir, Place, PlaceBase, Mutability, Static, StaticKind};
3+
use rustc::mir::{Mir, Place, PlaceBase, Mutability, Static, StaticKind};
44
use rustc::ty::{self, TyCtxt};
55
use crate::borrow_check::borrow_set::LocalsStateAtExit;
66

@@ -16,10 +16,6 @@ crate trait PlaceExt<'tcx> {
1616
mir: &Mir<'tcx>,
1717
locals_state_at_exit: &LocalsStateAtExit,
1818
) -> bool;
19-
20-
/// If this is a place like `x.f.g`, returns the local
21-
/// `x`. Returns `None` if this is based in a static.
22-
fn root_local(&self) -> Option<Local>;
2319
}
2420

2521
impl<'tcx> PlaceExt<'tcx> for Place<'tcx> {
@@ -82,15 +78,4 @@ impl<'tcx> PlaceExt<'tcx> for Place<'tcx> {
8278
},
8379
}
8480
}
85-
86-
fn root_local(&self) -> Option<Local> {
87-
let mut p = self;
88-
loop {
89-
match p {
90-
Place::Projection(pi) => p = &pi.base,
91-
Place::Base(PlaceBase::Static(_)) => return None,
92-
Place::Base(PlaceBase::Local(l)) => return Some(*l),
93-
}
94-
}
95-
}
9681
}

0 commit comments

Comments
 (0)