@@ -11,7 +11,6 @@ use crate::elaborate_drops::DropFlagState;
1111use crate :: framework:: SwitchIntEdgeEffects ;
1212use crate :: move_paths:: { HasMoveData , InitIndex , InitKind , LookupResult , MoveData , MovePathIndex } ;
1313use crate :: on_lookup_result_bits;
14- use crate :: MoveDataParamEnv ;
1514use crate :: { drop_flag_effects, on_all_children_bits} ;
1615use crate :: { lattice, AnalysisDomain , GenKill , GenKillAnalysis , MaybeReachable } ;
1716
@@ -53,17 +52,13 @@ use crate::{lattice, AnalysisDomain, GenKill, GenKillAnalysis, MaybeReachable};
5352pub struct MaybeInitializedPlaces < ' a , ' mir , ' tcx > {
5453 tcx : TyCtxt < ' tcx > ,
5554 body : & ' mir Body < ' tcx > ,
56- mdpe : & ' a MoveDataParamEnv < ' tcx > ,
55+ move_data : & ' a MoveData < ' tcx > ,
5756 skip_unreachable_unwind : bool ,
5857}
5958
6059impl < ' a , ' mir , ' tcx > MaybeInitializedPlaces < ' a , ' mir , ' tcx > {
61- pub fn new (
62- tcx : TyCtxt < ' tcx > ,
63- body : & ' mir Body < ' tcx > ,
64- mdpe : & ' a MoveDataParamEnv < ' tcx > ,
65- ) -> Self {
66- MaybeInitializedPlaces { tcx, body, mdpe, skip_unreachable_unwind : false }
60+ pub fn new ( tcx : TyCtxt < ' tcx > , body : & ' mir Body < ' tcx > , move_data : & ' a MoveData < ' tcx > ) -> Self {
61+ MaybeInitializedPlaces { tcx, body, move_data, skip_unreachable_unwind : false }
6762 }
6863
6964 pub fn skipping_unreachable_unwind ( mut self ) -> Self {
@@ -90,7 +85,7 @@ impl<'a, 'mir, 'tcx> MaybeInitializedPlaces<'a, 'mir, 'tcx> {
9085
9186impl < ' a , ' mir , ' tcx > HasMoveData < ' tcx > for MaybeInitializedPlaces < ' a , ' mir , ' tcx > {
9287 fn move_data ( & self ) -> & MoveData < ' tcx > {
93- & self . mdpe . move_data
88+ self . move_data
9489 }
9590}
9691
@@ -132,22 +127,18 @@ impl<'a, 'mir, 'tcx> HasMoveData<'tcx> for MaybeInitializedPlaces<'a, 'mir, 'tcx
132127pub struct MaybeUninitializedPlaces < ' a , ' mir , ' tcx > {
133128 tcx : TyCtxt < ' tcx > ,
134129 body : & ' mir Body < ' tcx > ,
135- mdpe : & ' a MoveDataParamEnv < ' tcx > ,
130+ move_data : & ' a MoveData < ' tcx > ,
136131
137132 mark_inactive_variants_as_uninit : bool ,
138133 skip_unreachable_unwind : BitSet < mir:: BasicBlock > ,
139134}
140135
141136impl < ' a , ' mir , ' tcx > MaybeUninitializedPlaces < ' a , ' mir , ' tcx > {
142- pub fn new (
143- tcx : TyCtxt < ' tcx > ,
144- body : & ' mir Body < ' tcx > ,
145- mdpe : & ' a MoveDataParamEnv < ' tcx > ,
146- ) -> Self {
137+ pub fn new ( tcx : TyCtxt < ' tcx > , body : & ' mir Body < ' tcx > , move_data : & ' a MoveData < ' tcx > ) -> Self {
147138 MaybeUninitializedPlaces {
148139 tcx,
149140 body,
150- mdpe ,
141+ move_data ,
151142 mark_inactive_variants_as_uninit : false ,
152143 skip_unreachable_unwind : BitSet :: new_empty ( body. basic_blocks . len ( ) ) ,
153144 }
@@ -174,7 +165,7 @@ impl<'a, 'mir, 'tcx> MaybeUninitializedPlaces<'a, 'mir, 'tcx> {
174165
175166impl < ' a , ' tcx > HasMoveData < ' tcx > for MaybeUninitializedPlaces < ' a , ' _ , ' tcx > {
176167 fn move_data ( & self ) -> & MoveData < ' tcx > {
177- & self . mdpe . move_data
168+ self . move_data
178169 }
179170}
180171
@@ -214,18 +205,18 @@ impl<'a, 'tcx> HasMoveData<'tcx> for MaybeUninitializedPlaces<'a, '_, 'tcx> {
214205/// that would require a dynamic drop-flag at that statement.
215206pub struct DefinitelyInitializedPlaces < ' a , ' tcx > {
216207 body : & ' a Body < ' tcx > ,
217- mdpe : & ' a MoveDataParamEnv < ' tcx > ,
208+ move_data : & ' a MoveData < ' tcx > ,
218209}
219210
220211impl < ' a , ' tcx > DefinitelyInitializedPlaces < ' a , ' tcx > {
221- pub fn new ( body : & ' a Body < ' tcx > , mdpe : & ' a MoveDataParamEnv < ' tcx > ) -> Self {
222- DefinitelyInitializedPlaces { body, mdpe }
212+ pub fn new ( body : & ' a Body < ' tcx > , move_data : & ' a MoveData < ' tcx > ) -> Self {
213+ DefinitelyInitializedPlaces { body, move_data }
223214 }
224215}
225216
226217impl < ' a , ' tcx > HasMoveData < ' tcx > for DefinitelyInitializedPlaces < ' a , ' tcx > {
227218 fn move_data ( & self ) -> & MoveData < ' tcx > {
228- & self . mdpe . move_data
219+ self . move_data
229220 }
230221}
231222
@@ -260,18 +251,18 @@ impl<'a, 'tcx> HasMoveData<'tcx> for DefinitelyInitializedPlaces<'a, 'tcx> {
260251/// ```
261252pub struct EverInitializedPlaces < ' a , ' mir , ' tcx > {
262253 body : & ' mir Body < ' tcx > ,
263- mdpe : & ' a MoveDataParamEnv < ' tcx > ,
254+ move_data : & ' a MoveData < ' tcx > ,
264255}
265256
266257impl < ' a , ' mir , ' tcx > EverInitializedPlaces < ' a , ' mir , ' tcx > {
267- pub fn new ( body : & ' mir Body < ' tcx > , mdpe : & ' a MoveDataParamEnv < ' tcx > ) -> Self {
268- EverInitializedPlaces { body, mdpe }
258+ pub fn new ( body : & ' mir Body < ' tcx > , move_data : & ' a MoveData < ' tcx > ) -> Self {
259+ EverInitializedPlaces { body, move_data }
269260 }
270261}
271262
272263impl < ' a , ' tcx > HasMoveData < ' tcx > for EverInitializedPlaces < ' a , ' _ , ' tcx > {
273264 fn move_data ( & self ) -> & MoveData < ' tcx > {
274- & self . mdpe . move_data
265+ self . move_data
275266 }
276267}
277268
@@ -329,7 +320,7 @@ impl<'tcx> AnalysisDomain<'tcx> for MaybeInitializedPlaces<'_, '_, 'tcx> {
329320 fn initialize_start_block ( & self , _: & mir:: Body < ' tcx > , state : & mut Self :: Domain ) {
330321 * state =
331322 MaybeReachable :: Reachable ( ChunkedBitSet :: new_empty ( self . move_data ( ) . move_paths . len ( ) ) ) ;
332- drop_flag_effects_for_function_entry ( self . body , self . mdpe , |path, s| {
323+ drop_flag_effects_for_function_entry ( self . body , self . move_data , |path, s| {
333324 assert ! ( s == DropFlagState :: Present ) ;
334325 state. gen_ ( path) ;
335326 } ) ;
@@ -349,7 +340,7 @@ impl<'tcx> GenKillAnalysis<'tcx> for MaybeInitializedPlaces<'_, '_, 'tcx> {
349340 statement : & mir:: Statement < ' tcx > ,
350341 location : Location ,
351342 ) {
352- drop_flag_effects_for_location ( self . body , self . mdpe , location, |path, s| {
343+ drop_flag_effects_for_location ( self . body , self . move_data , location, |path, s| {
353344 Self :: update_bits ( trans, path, s)
354345 } ) ;
355346
@@ -381,7 +372,7 @@ impl<'tcx> GenKillAnalysis<'tcx> for MaybeInitializedPlaces<'_, '_, 'tcx> {
381372 {
382373 edges = TerminatorEdges :: Single ( target) ;
383374 }
384- drop_flag_effects_for_location ( self . body , self . mdpe , location, |path, s| {
375+ drop_flag_effects_for_location ( self . body , self . move_data , location, |path, s| {
385376 Self :: update_bits ( state, path, s)
386377 } ) ;
387378 edges
@@ -466,7 +457,7 @@ impl<'tcx> AnalysisDomain<'tcx> for MaybeUninitializedPlaces<'_, '_, 'tcx> {
466457 // set all bits to 1 (uninit) before gathering counter-evidence
467458 state. insert_all ( ) ;
468459
469- drop_flag_effects_for_function_entry ( self . body , self . mdpe , |path, s| {
460+ drop_flag_effects_for_function_entry ( self . body , self . move_data , |path, s| {
470461 assert ! ( s == DropFlagState :: Present ) ;
471462 state. remove ( path) ;
472463 } ) ;
@@ -486,7 +477,7 @@ impl<'tcx> GenKillAnalysis<'tcx> for MaybeUninitializedPlaces<'_, '_, 'tcx> {
486477 _statement : & mir:: Statement < ' tcx > ,
487478 location : Location ,
488479 ) {
489- drop_flag_effects_for_location ( self . body , self . mdpe , location, |path, s| {
480+ drop_flag_effects_for_location ( self . body , self . move_data , location, |path, s| {
490481 Self :: update_bits ( trans, path, s)
491482 } ) ;
492483
@@ -500,7 +491,7 @@ impl<'tcx> GenKillAnalysis<'tcx> for MaybeUninitializedPlaces<'_, '_, 'tcx> {
500491 terminator : & ' mir mir:: Terminator < ' tcx > ,
501492 location : Location ,
502493 ) -> TerminatorEdges < ' mir , ' tcx > {
503- drop_flag_effects_for_location ( self . body , self . mdpe , location, |path, s| {
494+ drop_flag_effects_for_location ( self . body , self . move_data , location, |path, s| {
504495 Self :: update_bits ( trans, path, s)
505496 } ) ;
506497 if self . skip_unreachable_unwind . contains ( location. block ) {
@@ -593,7 +584,7 @@ impl<'a, 'tcx> AnalysisDomain<'tcx> for DefinitelyInitializedPlaces<'a, 'tcx> {
593584 fn initialize_start_block ( & self , _: & mir:: Body < ' tcx > , state : & mut Self :: Domain ) {
594585 state. 0 . clear ( ) ;
595586
596- drop_flag_effects_for_function_entry ( self . body , self . mdpe , |path, s| {
587+ drop_flag_effects_for_function_entry ( self . body , self . move_data , |path, s| {
597588 assert ! ( s == DropFlagState :: Present ) ;
598589 state. 0 . insert ( path) ;
599590 } ) ;
@@ -613,7 +604,7 @@ impl<'tcx> GenKillAnalysis<'tcx> for DefinitelyInitializedPlaces<'_, 'tcx> {
613604 _statement : & mir:: Statement < ' tcx > ,
614605 location : Location ,
615606 ) {
616- drop_flag_effects_for_location ( self . body , self . mdpe , location, |path, s| {
607+ drop_flag_effects_for_location ( self . body , self . move_data , location, |path, s| {
617608 Self :: update_bits ( trans, path, s)
618609 } )
619610 }
@@ -624,7 +615,7 @@ impl<'tcx> GenKillAnalysis<'tcx> for DefinitelyInitializedPlaces<'_, 'tcx> {
624615 terminator : & ' mir mir:: Terminator < ' tcx > ,
625616 location : Location ,
626617 ) -> TerminatorEdges < ' mir , ' tcx > {
627- drop_flag_effects_for_location ( self . body , self . mdpe , location, |path, s| {
618+ drop_flag_effects_for_location ( self . body , self . move_data , location, |path, s| {
628619 Self :: update_bits ( trans, path, s)
629620 } ) ;
630621 terminator. edges ( )
0 commit comments