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