Skip to content

Commit 64c85e5

Browse files
csmoespastorino
authored andcommitted
introduce neoplace in dataflow/impls
1 parent 2286719 commit 64c85e5

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/librustc_mir/dataflow/impls/borrows.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ use borrow_check::place_ext::PlaceExt;
44
use rustc::mir::{self, Location, Place, Mir};
55
use rustc::ty::TyCtxt;
66
use rustc::ty::RegionVid;
7+
use rustc::mir::PlaceBase;
78

89
use rustc_data_structures::bit_set::{BitSet, BitSetOperator};
910
use rustc_data_structures::fx::FxHashMap;
@@ -188,8 +189,9 @@ impl<'a, 'gcx, 'tcx> Borrows<'a, 'gcx, 'tcx> {
188189
place: &Place<'tcx>
189190
) {
190191
debug!("kill_borrows_on_place: place={:?}", place);
191-
// Handle the `Place::Local(..)` case first and exit early.
192-
if let Place::Local(local) = place {
192+
// Handle the `PlaceBase::Local(..)` case first and exit early.
193+
let neo_place = self.tcx.as_new_place(place);
194+
if let Some(PlaceBase::Local(local)) = neo_place.as_place_base() {
193195
if let Some(borrow_indices) = self.borrow_set.local_map.get(&local) {
194196
debug!("kill_borrows_on_place: borrow_indices={:?}", borrow_indices);
195197
sets.kill_all(borrow_indices);
@@ -260,13 +262,13 @@ impl<'a, 'gcx, 'tcx> BitDenotation<'tcx> for Borrows<'a, 'gcx, 'tcx> {
260262
});
261263

262264
debug!("Borrows::statement_effect: stmt={:?}", stmt);
263-
match stmt.kind {
264-
mir::StatementKind::Assign(ref lhs, ref rhs) => {
265+
match &stmt.kind {
266+
mir::StatementKind::Assign(lhs, rhs) => {
265267
// Make sure there are no remaining borrows for variables
266268
// that are assigned over.
267269
self.kill_borrows_on_place(sets, lhs);
268270

269-
if let mir::Rvalue::Ref(_, _, ref place) = **rhs {
271+
if let box mir::Rvalue::Ref(_, _, place) = rhs {
270272
if place.ignore_borrow(
271273
self.tcx,
272274
self.mir,
@@ -285,7 +287,7 @@ impl<'a, 'gcx, 'tcx> BitDenotation<'tcx> for Borrows<'a, 'gcx, 'tcx> {
285287
mir::StatementKind::StorageDead(local) => {
286288
// Make sure there are no remaining borrows for locals that
287289
// are gone out of scope.
288-
self.kill_borrows_on_place(sets, &Place::Local(local));
290+
self.kill_borrows_on_place(sets, &Place::Local(*local));
289291
}
290292

291293
mir::StatementKind::InlineAsm { ref outputs, ref asm, .. } => {

0 commit comments

Comments
 (0)