@@ -11,7 +11,6 @@ use crate::elaborate_drops::DropFlagState;
11
11
use crate :: framework:: SwitchIntEdgeEffects ;
12
12
use crate :: move_paths:: { HasMoveData , InitIndex , InitKind , LookupResult , MoveData , MovePathIndex } ;
13
13
use crate :: on_lookup_result_bits;
14
- use crate :: MoveDataParamEnv ;
15
14
use crate :: { drop_flag_effects, on_all_children_bits} ;
16
15
use crate :: { lattice, AnalysisDomain , GenKill , GenKillAnalysis , MaybeReachable } ;
17
16
@@ -53,17 +52,13 @@ use crate::{lattice, AnalysisDomain, GenKill, GenKillAnalysis, MaybeReachable};
53
52
pub struct MaybeInitializedPlaces < ' a , ' mir , ' tcx > {
54
53
tcx : TyCtxt < ' tcx > ,
55
54
body : & ' mir Body < ' tcx > ,
56
- mdpe : & ' a MoveDataParamEnv < ' tcx > ,
55
+ move_data : & ' a MoveData < ' tcx > ,
57
56
skip_unreachable_unwind : bool ,
58
57
}
59
58
60
59
impl < ' 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 }
67
62
}
68
63
69
64
pub fn skipping_unreachable_unwind ( mut self ) -> Self {
@@ -90,7 +85,7 @@ impl<'a, 'mir, 'tcx> MaybeInitializedPlaces<'a, 'mir, 'tcx> {
90
85
91
86
impl < ' a , ' mir , ' tcx > HasMoveData < ' tcx > for MaybeInitializedPlaces < ' a , ' mir , ' tcx > {
92
87
fn move_data ( & self ) -> & MoveData < ' tcx > {
93
- & self . mdpe . move_data
88
+ self . move_data
94
89
}
95
90
}
96
91
@@ -132,22 +127,18 @@ impl<'a, 'mir, 'tcx> HasMoveData<'tcx> for MaybeInitializedPlaces<'a, 'mir, 'tcx
132
127
pub struct MaybeUninitializedPlaces < ' a , ' mir , ' tcx > {
133
128
tcx : TyCtxt < ' tcx > ,
134
129
body : & ' mir Body < ' tcx > ,
135
- mdpe : & ' a MoveDataParamEnv < ' tcx > ,
130
+ move_data : & ' a MoveData < ' tcx > ,
136
131
137
132
mark_inactive_variants_as_uninit : bool ,
138
133
skip_unreachable_unwind : BitSet < mir:: BasicBlock > ,
139
134
}
140
135
141
136
impl < ' 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 {
147
138
MaybeUninitializedPlaces {
148
139
tcx,
149
140
body,
150
- mdpe ,
141
+ move_data ,
151
142
mark_inactive_variants_as_uninit : false ,
152
143
skip_unreachable_unwind : BitSet :: new_empty ( body. basic_blocks . len ( ) ) ,
153
144
}
@@ -174,7 +165,7 @@ impl<'a, 'mir, 'tcx> MaybeUninitializedPlaces<'a, 'mir, 'tcx> {
174
165
175
166
impl < ' a , ' tcx > HasMoveData < ' tcx > for MaybeUninitializedPlaces < ' a , ' _ , ' tcx > {
176
167
fn move_data ( & self ) -> & MoveData < ' tcx > {
177
- & self . mdpe . move_data
168
+ self . move_data
178
169
}
179
170
}
180
171
@@ -214,18 +205,18 @@ impl<'a, 'tcx> HasMoveData<'tcx> for MaybeUninitializedPlaces<'a, '_, 'tcx> {
214
205
/// that would require a dynamic drop-flag at that statement.
215
206
pub struct DefinitelyInitializedPlaces < ' a , ' tcx > {
216
207
body : & ' a Body < ' tcx > ,
217
- mdpe : & ' a MoveDataParamEnv < ' tcx > ,
208
+ move_data : & ' a MoveData < ' tcx > ,
218
209
}
219
210
220
211
impl < ' 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 }
223
214
}
224
215
}
225
216
226
217
impl < ' a , ' tcx > HasMoveData < ' tcx > for DefinitelyInitializedPlaces < ' a , ' tcx > {
227
218
fn move_data ( & self ) -> & MoveData < ' tcx > {
228
- & self . mdpe . move_data
219
+ self . move_data
229
220
}
230
221
}
231
222
@@ -260,18 +251,18 @@ impl<'a, 'tcx> HasMoveData<'tcx> for DefinitelyInitializedPlaces<'a, 'tcx> {
260
251
/// ```
261
252
pub struct EverInitializedPlaces < ' a , ' mir , ' tcx > {
262
253
body : & ' mir Body < ' tcx > ,
263
- mdpe : & ' a MoveDataParamEnv < ' tcx > ,
254
+ move_data : & ' a MoveData < ' tcx > ,
264
255
}
265
256
266
257
impl < ' 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 }
269
260
}
270
261
}
271
262
272
263
impl < ' a , ' tcx > HasMoveData < ' tcx > for EverInitializedPlaces < ' a , ' _ , ' tcx > {
273
264
fn move_data ( & self ) -> & MoveData < ' tcx > {
274
- & self . mdpe . move_data
265
+ self . move_data
275
266
}
276
267
}
277
268
@@ -329,7 +320,7 @@ impl<'tcx> AnalysisDomain<'tcx> for MaybeInitializedPlaces<'_, '_, 'tcx> {
329
320
fn initialize_start_block ( & self , _: & mir:: Body < ' tcx > , state : & mut Self :: Domain ) {
330
321
* state =
331
322
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| {
333
324
assert ! ( s == DropFlagState :: Present ) ;
334
325
state. gen_ ( path) ;
335
326
} ) ;
@@ -349,7 +340,7 @@ impl<'tcx> GenKillAnalysis<'tcx> for MaybeInitializedPlaces<'_, '_, 'tcx> {
349
340
statement : & mir:: Statement < ' tcx > ,
350
341
location : Location ,
351
342
) {
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| {
353
344
Self :: update_bits ( trans, path, s)
354
345
} ) ;
355
346
@@ -381,7 +372,7 @@ impl<'tcx> GenKillAnalysis<'tcx> for MaybeInitializedPlaces<'_, '_, 'tcx> {
381
372
{
382
373
edges = TerminatorEdges :: Single ( target) ;
383
374
}
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| {
385
376
Self :: update_bits ( state, path, s)
386
377
} ) ;
387
378
edges
@@ -466,7 +457,7 @@ impl<'tcx> AnalysisDomain<'tcx> for MaybeUninitializedPlaces<'_, '_, 'tcx> {
466
457
// set all bits to 1 (uninit) before gathering counter-evidence
467
458
state. insert_all ( ) ;
468
459
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| {
470
461
assert ! ( s == DropFlagState :: Present ) ;
471
462
state. remove ( path) ;
472
463
} ) ;
@@ -486,7 +477,7 @@ impl<'tcx> GenKillAnalysis<'tcx> for MaybeUninitializedPlaces<'_, '_, 'tcx> {
486
477
_statement : & mir:: Statement < ' tcx > ,
487
478
location : Location ,
488
479
) {
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| {
490
481
Self :: update_bits ( trans, path, s)
491
482
} ) ;
492
483
@@ -500,7 +491,7 @@ impl<'tcx> GenKillAnalysis<'tcx> for MaybeUninitializedPlaces<'_, '_, 'tcx> {
500
491
terminator : & ' mir mir:: Terminator < ' tcx > ,
501
492
location : Location ,
502
493
) -> 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| {
504
495
Self :: update_bits ( trans, path, s)
505
496
} ) ;
506
497
if self . skip_unreachable_unwind . contains ( location. block ) {
@@ -593,7 +584,7 @@ impl<'a, 'tcx> AnalysisDomain<'tcx> for DefinitelyInitializedPlaces<'a, 'tcx> {
593
584
fn initialize_start_block ( & self , _: & mir:: Body < ' tcx > , state : & mut Self :: Domain ) {
594
585
state. 0 . clear ( ) ;
595
586
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| {
597
588
assert ! ( s == DropFlagState :: Present ) ;
598
589
state. 0 . insert ( path) ;
599
590
} ) ;
@@ -613,7 +604,7 @@ impl<'tcx> GenKillAnalysis<'tcx> for DefinitelyInitializedPlaces<'_, 'tcx> {
613
604
_statement : & mir:: Statement < ' tcx > ,
614
605
location : Location ,
615
606
) {
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| {
617
608
Self :: update_bits ( trans, path, s)
618
609
} )
619
610
}
@@ -624,7 +615,7 @@ impl<'tcx> GenKillAnalysis<'tcx> for DefinitelyInitializedPlaces<'_, 'tcx> {
624
615
terminator : & ' mir mir:: Terminator < ' tcx > ,
625
616
location : Location ,
626
617
) -> 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| {
628
619
Self :: update_bits ( trans, path, s)
629
620
} ) ;
630
621
terminator. edges ( )
0 commit comments