@@ -13,15 +13,15 @@ use dataflow::move_paths::{HasMoveData, MoveData};
1313use dataflow:: MaybeInitializedPlaces ;
1414use dataflow:: { FlowAtLocation , FlowsAtLocation } ;
1515use rustc:: infer:: canonical:: QueryRegionConstraint ;
16- use rustc:: mir:: { Local , LocalWithRegion } ;
16+ use rustc:: mir:: LocalWithRegion ;
1717use rustc:: mir:: { BasicBlock , Location , Mir } ;
1818use rustc:: traits:: query:: dropck_outlives:: DropckOutlivesResult ;
1919use rustc:: traits:: query:: type_op:: outlives:: DropckOutlives ;
2020use rustc:: traits:: query:: type_op:: TypeOp ;
2121use rustc:: ty:: { Ty , TypeFoldable } ;
2222use rustc_data_structures:: fx:: FxHashMap ;
2323use std:: rc:: Rc ;
24- use util:: liveness:: { IdentityMap , LivenessResults } ;
24+ use util:: liveness:: { NllLivenessMap , LivenessResults , LiveVariableMap } ;
2525
2626use super :: TypeChecker ;
2727
@@ -47,7 +47,7 @@ pub(super) fn generate<'gcx, 'tcx>(
4747 flow_inits,
4848 move_data,
4949 drop_data : FxHashMap ( ) ,
50- map : & IdentityMap :: new ( mir) ,
50+ map : & NllLivenessMap :: compute ( mir) ,
5151 } ;
5252
5353 for bb in mir. basic_blocks ( ) . indices ( ) {
6868 flow_inits : & ' gen mut FlowAtLocation < MaybeInitializedPlaces < ' flow , ' gcx , ' tcx > > ,
6969 move_data : & ' gen MoveData < ' tcx > ,
7070 drop_data : FxHashMap < Ty < ' tcx > , DropData < ' tcx > > ,
71- map : & ' gen IdentityMap < ' gen , ' tcx > ,
71+ map : & ' gen NllLivenessMap ,
7272}
7373
7474struct DropData < ' tcx > {
@@ -88,7 +88,8 @@ impl<'gen, 'typeck, 'flow, 'gcx, 'tcx> TypeLivenessGenerator<'gen, 'typeck, 'flo
8888 . regular
8989 . simulate_block ( self . mir , bb, self . map , |location, live_locals| {
9090 for live_local in live_locals. iter ( ) {
91- let live_local_ty = self . mir . local_decls [ live_local] . ty ;
91+ let local = self . map . from_live_var ( live_local) ;
92+ let live_local_ty = self . mir . local_decls [ local] . ty ;
9293 Self :: push_type_live_constraint ( & mut self . cx , live_local_ty, location) ;
9394 }
9495 } ) ;
@@ -123,15 +124,17 @@ impl<'gen, 'typeck, 'flow, 'gcx, 'tcx> TypeLivenessGenerator<'gen, 'typeck, 'flo
123124 } ) ;
124125 }
125126
126- let mpi = self . move_data . rev_lookup . find_local ( live_local) ;
127+ let local = self . map . from_live_var ( live_local) ;
128+ let mpi = self . move_data . rev_lookup . find_local ( local) ;
127129 if let Some ( initialized_child) = self . flow_inits . has_any_child_of ( mpi) {
128130 debug ! (
129131 "add_liveness_constraints: mpi={:?} has initialized child {:?}" ,
130132 self . move_data. move_paths[ mpi] ,
131133 self . move_data. move_paths[ initialized_child]
132134 ) ;
133135
134- let live_local_ty = self . mir . local_decls [ live_local] . ty ;
136+ let local = self . map . from_live_var ( live_local) ;
137+ let live_local_ty = self . mir . local_decls [ local] . ty ;
135138 self . add_drop_live_constraint ( live_local, live_local_ty, location) ;
136139 }
137140 }
0 commit comments