Skip to content

Commit 63167ba

Browse files
csmoespastorino
authored andcommitted
generate prefixes for place
1 parent 8ca7fc6 commit 63167ba

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

src/librustc/mir/tcx.rs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -317,9 +317,6 @@ impl<'tcx> NeoPlace<'tcx> {
317317
tcx: TyCtxt<'cx, 'gcx, 'tcx>,
318318
elem_index: usize,
319319
) -> Self {
320-
// only works for place with projections
321-
assert!(!self.elems.is_empty());
322-
323320
if elem_index < 1 {
324321
// Base.[a]
325322
// ^-- elems[0]
@@ -335,6 +332,20 @@ impl<'tcx> NeoPlace<'tcx> {
335332
}
336333
}
337334

335+
pub fn prefixes<'cx, 'gcx>(
336+
&self,
337+
tcx: TyCtxt<'cx, 'gcx, 'tcx>,
338+
) -> Vec<Self> {
339+
// only works for place with projections
340+
assert!(!self.elems.is_empty());
341+
342+
self.elems
343+
.iter()
344+
.enumerate()
345+
.map(|(elem_index, _)| self.prefix(tcx, elem_index))
346+
.collect::<Vec<NeoPlace<'tcx>>>()
347+
}
348+
338349
// Generate types of sub-places
339350
//
340351
// Base.[a, b]

src/librustc_mir/borrow_check/borrow_set.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,6 @@ use rustc::mir::visit::{
88
};
99
use rustc::mir::{self, Location, Mir, Local};
1010
use rustc::ty::{RegionVid, TyCtxt};
11-
<<<<<<< HEAD
12-
||||||| merged common ancestors
13-
use rustc::mir::PlaceBase;
14-
use rustc::ty::{RegionVid, TyCtxt};
15-
=======
16-
use rustc::mir::PlaceBase;
17-
>>>>>>> generate tys of sub-places
1811
use rustc::util::nodemap::{FxHashMap, FxHashSet};
1912
use rustc_data_structures::indexed_vec::IndexVec;
2013
use rustc_data_structures::bit_set::BitSet;

0 commit comments

Comments
 (0)