File tree Expand file tree Collapse file tree 2 files changed +14
-10
lines changed
librustc_mir/borrow_check Expand file tree Collapse file tree 2 files changed +14
-10
lines changed Original file line number Diff line number Diff 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]
Original file line number Diff line number Diff line change @@ -8,13 +8,6 @@ use rustc::mir::visit::{
88} ;
99use rustc:: mir:: { self , Location , Mir , Local } ;
1010use 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
1811use rustc:: util:: nodemap:: { FxHashMap , FxHashSet } ;
1912use rustc_data_structures:: indexed_vec:: IndexVec ;
2013use rustc_data_structures:: bit_set:: BitSet ;
You can’t perform that action at this time.
0 commit comments