@@ -11,7 +11,7 @@ use crate::move_paths::{HasMoveData, InitIndex, InitKind, LookupResult, MoveData
1111use crate :: {
1212 drop_flag_effects, drop_flag_effects_for_function_entry, drop_flag_effects_for_location,
1313 lattice, on_all_children_bits, on_lookup_result_bits, AnalysisDomain , GenKill , GenKillAnalysis ,
14- MaybeReachable , MoveDataParamEnv ,
14+ MaybeReachable ,
1515} ;
1616
1717/// `MaybeInitializedPlaces` tracks all places that might be
@@ -52,17 +52,13 @@ use crate::{
5252pub struct MaybeInitializedPlaces < ' a , ' mir , ' tcx > {
5353 tcx : TyCtxt < ' tcx > ,
5454 body : & ' mir Body < ' tcx > ,
55- mdpe : & ' a MoveDataParamEnv < ' tcx > ,
55+ move_data : & ' a MoveData < ' tcx > ,
5656 skip_unreachable_unwind : bool ,
5757}
5858
5959impl < ' a , ' mir , ' tcx > MaybeInitializedPlaces < ' a , ' mir , ' tcx > {
60- pub fn new (
61- tcx : TyCtxt < ' tcx > ,
62- body : & ' mir Body < ' tcx > ,
63- mdpe : & ' a MoveDataParamEnv < ' tcx > ,
64- ) -> Self {
65- 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 }
6662 }
6763
6864 pub fn skipping_unreachable_unwind ( mut self ) -> Self {
@@ -89,7 +85,7 @@ impl<'a, 'mir, 'tcx> MaybeInitializedPlaces<'a, 'mir, 'tcx> {
8985
9086impl < ' a , ' mir , ' tcx > HasMoveData < ' tcx > for MaybeInitializedPlaces < ' a , ' mir , ' tcx > {
9187 fn move_data ( & self ) -> & MoveData < ' tcx > {
92- & self . mdpe . move_data
88+ self . move_data
9389 }
9490}
9591
@@ -131,22 +127,18 @@ impl<'a, 'mir, 'tcx> HasMoveData<'tcx> for MaybeInitializedPlaces<'a, 'mir, 'tcx
131127pub struct MaybeUninitializedPlaces < ' a , ' mir , ' tcx > {
132128 tcx : TyCtxt < ' tcx > ,
133129 body : & ' mir Body < ' tcx > ,
134- mdpe : & ' a MoveDataParamEnv < ' tcx > ,
130+ move_data : & ' a MoveData < ' tcx > ,
135131
136132 mark_inactive_variants_as_uninit : bool ,
137133 skip_unreachable_unwind : BitSet < mir:: BasicBlock > ,
138134}
139135
140136impl < ' a , ' mir , ' tcx > MaybeUninitializedPlaces < ' a , ' mir , ' tcx > {
141- pub fn new (
142- tcx : TyCtxt < ' tcx > ,
143- body : & ' mir Body < ' tcx > ,
144- mdpe : & ' a MoveDataParamEnv < ' tcx > ,
145- ) -> Self {
137+ pub fn new ( tcx : TyCtxt < ' tcx > , body : & ' mir Body < ' tcx > , move_data : & ' a MoveData < ' tcx > ) -> Self {
146138 MaybeUninitializedPlaces {
147139 tcx,
148140 body,
149- mdpe ,
141+ move_data ,
150142 mark_inactive_variants_as_uninit : false ,
151143 skip_unreachable_unwind : BitSet :: new_empty ( body. basic_blocks . len ( ) ) ,
152144 }
@@ -173,7 +165,7 @@ impl<'a, 'mir, 'tcx> MaybeUninitializedPlaces<'a, 'mir, 'tcx> {
173165
174166impl < ' a , ' tcx > HasMoveData < ' tcx > for MaybeUninitializedPlaces < ' a , ' _ , ' tcx > {
175167 fn move_data ( & self ) -> & MoveData < ' tcx > {
176- & self . mdpe . move_data
168+ self . move_data
177169 }
178170}
179171
@@ -213,18 +205,18 @@ impl<'a, 'tcx> HasMoveData<'tcx> for MaybeUninitializedPlaces<'a, '_, 'tcx> {
213205/// that would require a dynamic drop-flag at that statement.
214206pub struct DefinitelyInitializedPlaces < ' a , ' tcx > {
215207 body : & ' a Body < ' tcx > ,
216- mdpe : & ' a MoveDataParamEnv < ' tcx > ,
208+ move_data : & ' a MoveData < ' tcx > ,
217209}
218210
219211impl < ' a , ' tcx > DefinitelyInitializedPlaces < ' a , ' tcx > {
220- pub fn new ( body : & ' a Body < ' tcx > , mdpe : & ' a MoveDataParamEnv < ' tcx > ) -> Self {
221- DefinitelyInitializedPlaces { body, mdpe }
212+ pub fn new ( body : & ' a Body < ' tcx > , move_data : & ' a MoveData < ' tcx > ) -> Self {
213+ DefinitelyInitializedPlaces { body, move_data }
222214 }
223215}
224216
225217impl < ' a , ' tcx > HasMoveData < ' tcx > for DefinitelyInitializedPlaces < ' a , ' tcx > {
226218 fn move_data ( & self ) -> & MoveData < ' tcx > {
227- & self . mdpe . move_data
219+ self . move_data
228220 }
229221}
230222
@@ -259,18 +251,18 @@ impl<'a, 'tcx> HasMoveData<'tcx> for DefinitelyInitializedPlaces<'a, 'tcx> {
259251/// ```
260252pub struct EverInitializedPlaces < ' a , ' mir , ' tcx > {
261253 body : & ' mir Body < ' tcx > ,
262- mdpe : & ' a MoveDataParamEnv < ' tcx > ,
254+ move_data : & ' a MoveData < ' tcx > ,
263255}
264256
265257impl < ' a , ' mir , ' tcx > EverInitializedPlaces < ' a , ' mir , ' tcx > {
266- pub fn new ( body : & ' mir Body < ' tcx > , mdpe : & ' a MoveDataParamEnv < ' tcx > ) -> Self {
267- EverInitializedPlaces { body, mdpe }
258+ pub fn new ( body : & ' mir Body < ' tcx > , move_data : & ' a MoveData < ' tcx > ) -> Self {
259+ EverInitializedPlaces { body, move_data }
268260 }
269261}
270262
271263impl < ' a , ' tcx > HasMoveData < ' tcx > for EverInitializedPlaces < ' a , ' _ , ' tcx > {
272264 fn move_data ( & self ) -> & MoveData < ' tcx > {
273- & self . mdpe . move_data
265+ self . move_data
274266 }
275267}
276268
@@ -328,7 +320,7 @@ impl<'tcx> AnalysisDomain<'tcx> for MaybeInitializedPlaces<'_, '_, 'tcx> {
328320 fn initialize_start_block ( & self , _: & mir:: Body < ' tcx > , state : & mut Self :: Domain ) {
329321 * state =
330322 MaybeReachable :: Reachable ( ChunkedBitSet :: new_empty ( self . move_data ( ) . move_paths . len ( ) ) ) ;
331- 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| {
332324 assert ! ( s == DropFlagState :: Present ) ;
333325 state. gen_ ( path) ;
334326 } ) ;
@@ -348,7 +340,7 @@ impl<'tcx> GenKillAnalysis<'tcx> for MaybeInitializedPlaces<'_, '_, 'tcx> {
348340 statement : & mir:: Statement < ' tcx > ,
349341 location : Location ,
350342 ) {
351- 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| {
352344 Self :: update_bits ( trans, path, s)
353345 } ) ;
354346
@@ -380,7 +372,7 @@ impl<'tcx> GenKillAnalysis<'tcx> for MaybeInitializedPlaces<'_, '_, 'tcx> {
380372 {
381373 edges = TerminatorEdges :: Single ( target) ;
382374 }
383- 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| {
384376 Self :: update_bits ( state, path, s)
385377 } ) ;
386378 edges
@@ -465,7 +457,7 @@ impl<'tcx> AnalysisDomain<'tcx> for MaybeUninitializedPlaces<'_, '_, 'tcx> {
465457 // set all bits to 1 (uninit) before gathering counter-evidence
466458 state. insert_all ( ) ;
467459
468- 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| {
469461 assert ! ( s == DropFlagState :: Present ) ;
470462 state. remove ( path) ;
471463 } ) ;
@@ -485,7 +477,7 @@ impl<'tcx> GenKillAnalysis<'tcx> for MaybeUninitializedPlaces<'_, '_, 'tcx> {
485477 _statement : & mir:: Statement < ' tcx > ,
486478 location : Location ,
487479 ) {
488- 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| {
489481 Self :: update_bits ( trans, path, s)
490482 } ) ;
491483
@@ -499,7 +491,7 @@ impl<'tcx> GenKillAnalysis<'tcx> for MaybeUninitializedPlaces<'_, '_, 'tcx> {
499491 terminator : & ' mir mir:: Terminator < ' tcx > ,
500492 location : Location ,
501493 ) -> TerminatorEdges < ' mir , ' tcx > {
502- 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| {
503495 Self :: update_bits ( trans, path, s)
504496 } ) ;
505497 if self . skip_unreachable_unwind . contains ( location. block ) {
@@ -592,7 +584,7 @@ impl<'a, 'tcx> AnalysisDomain<'tcx> for DefinitelyInitializedPlaces<'a, 'tcx> {
592584 fn initialize_start_block ( & self , _: & mir:: Body < ' tcx > , state : & mut Self :: Domain ) {
593585 state. 0 . clear ( ) ;
594586
595- 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| {
596588 assert ! ( s == DropFlagState :: Present ) ;
597589 state. 0 . insert ( path) ;
598590 } ) ;
@@ -612,7 +604,7 @@ impl<'tcx> GenKillAnalysis<'tcx> for DefinitelyInitializedPlaces<'_, 'tcx> {
612604 _statement : & mir:: Statement < ' tcx > ,
613605 location : Location ,
614606 ) {
615- 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| {
616608 Self :: update_bits ( trans, path, s)
617609 } )
618610 }
@@ -623,7 +615,7 @@ impl<'tcx> GenKillAnalysis<'tcx> for DefinitelyInitializedPlaces<'_, 'tcx> {
623615 terminator : & ' mir mir:: Terminator < ' tcx > ,
624616 location : Location ,
625617 ) -> TerminatorEdges < ' mir , ' tcx > {
626- 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| {
627619 Self :: update_bits ( trans, path, s)
628620 } ) ;
629621 terminator. edges ( )
0 commit comments