11use crate :: dataflow;
2- use crate :: dataflow:: impls:: { MaybeInitializedPlaces , MaybeUninitializedPlaces } ;
32use crate :: dataflow:: move_paths:: { LookupResult , MoveData , MovePathIndex } ;
43use crate :: dataflow:: on_lookup_result_bits;
54use crate :: dataflow:: MoveDataParamEnv ;
65use crate :: dataflow:: { on_all_children_bits, on_all_drop_children_bits} ;
76use crate :: dataflow:: { Analysis , ResultsCursor } ;
7+ use crate :: dataflow:: { MaybeInitializedPlaces , MaybeUninitializedPlaces } ;
88use crate :: transform:: { MirPass , MirSource } ;
99use crate :: util:: elaborate_drops:: { elaborate_drop, DropFlagState , Unwind } ;
1010use crate :: util:: elaborate_drops:: { DropElaborator , DropFlagMode , DropStyle } ;
@@ -48,7 +48,6 @@ impl<'tcx> MirPass<'tcx> for ElaborateDrops {
4848 . into_results_cursor ( body) ;
4949
5050 let uninits = MaybeUninitializedPlaces :: new ( tcx, body, & env)
51- . mark_inactive_variants_as_uninit ( )
5251 . into_engine ( tcx, body, def_id)
5352 . dead_unwinds ( & dead_unwinds)
5453 . iterate_to_fixpoint ( )
@@ -86,27 +85,27 @@ fn find_dead_unwinds<'tcx>(
8685 . iterate_to_fixpoint ( )
8786 . into_results_cursor ( body) ;
8887 for ( bb, bb_data) in body. basic_blocks ( ) . iter_enumerated ( ) {
89- let place = match bb_data. terminator ( ) . kind {
90- TerminatorKind :: Drop { ref place , unwind : Some ( _) , .. }
91- | TerminatorKind :: DropAndReplace { ref place , unwind : Some ( _) , .. } => place ,
88+ let location = match bb_data. terminator ( ) . kind {
89+ TerminatorKind :: Drop { ref location , unwind : Some ( _) , .. }
90+ | TerminatorKind :: DropAndReplace { ref location , unwind : Some ( _) , .. } => location ,
9291 _ => continue ,
9392 } ;
9493
9594 debug ! ( "find_dead_unwinds @ {:?}: {:?}" , bb, bb_data) ;
9695
97- let path = match env. move_data . rev_lookup . find ( place . as_ref ( ) ) {
96+ let path = match env. move_data . rev_lookup . find ( location . as_ref ( ) ) {
9897 LookupResult :: Exact ( e) => e,
9998 LookupResult :: Parent ( ..) => {
10099 debug ! ( "find_dead_unwinds: has parent; skipping" ) ;
101100 continue ;
102101 }
103102 } ;
104103
105- flow_inits. seek_before_primary_effect ( body. terminator_loc ( bb) ) ;
104+ flow_inits. seek_before ( body. terminator_loc ( bb) ) ;
106105 debug ! (
107106 "find_dead_unwinds @ {:?}: path({:?})={:?}; init_data={:?}" ,
108107 bb,
109- place ,
108+ location ,
110109 path,
111110 flow_inits. get( )
112111 ) ;
@@ -132,8 +131,8 @@ struct InitializationData<'mir, 'tcx> {
132131
133132impl InitializationData < ' _ , ' _ > {
134133 fn seek_before ( & mut self , loc : Location ) {
135- self . inits . seek_before_primary_effect ( loc) ;
136- self . uninits . seek_before_primary_effect ( loc) ;
134+ self . inits . seek_before ( loc) ;
135+ self . uninits . seek_before ( loc) ;
137136 }
138137
139138 fn maybe_live_dead ( & self , path : MovePathIndex ) -> ( bool , bool ) {
@@ -214,31 +213,31 @@ impl<'a, 'b, 'tcx> DropElaborator<'a, 'tcx> for Elaborator<'a, 'b, 'tcx> {
214213
215214 fn field_subpath ( & self , path : Self :: Path , field : Field ) -> Option < Self :: Path > {
216215 dataflow:: move_path_children_matching ( self . ctxt . move_data ( ) , path, |e| match e {
217- ProjectionElem :: Field ( idx, _) => idx == field,
216+ ProjectionElem :: Field ( idx, _) => * idx == field,
218217 _ => false ,
219218 } )
220219 }
221220
222- fn array_subpath ( & self , path : Self :: Path , index : u32 , size : u32 ) -> Option < Self :: Path > {
221+ fn array_subpath ( & self , path : Self :: Path , index : u64 , size : u64 ) -> Option < Self :: Path > {
223222 dataflow:: move_path_children_matching ( self . ctxt . move_data ( ) , path, |e| match e {
224223 ProjectionElem :: ConstantIndex { offset, min_length, from_end } => {
225- debug_assert ! ( size == min_length, "min_length should be exact for arrays" ) ;
224+ debug_assert ! ( size == * min_length as u64 , "min_length should be exact for arrays" ) ;
226225 assert ! ( !from_end, "from_end should not be used for array element ConstantIndex" ) ;
227- offset == index
226+ * offset == index
228227 }
229228 _ => false ,
230229 } )
231230 }
232231
233232 fn deref_subpath ( & self , path : Self :: Path ) -> Option < Self :: Path > {
234233 dataflow:: move_path_children_matching ( self . ctxt . move_data ( ) , path, |e| {
235- e == ProjectionElem :: Deref
234+ * e == ProjectionElem :: Deref
236235 } )
237236 }
238237
239238 fn downcast_subpath ( & self , path : Self :: Path , variant : VariantIdx ) -> Option < Self :: Path > {
240239 dataflow:: move_path_children_matching ( self . ctxt . move_data ( ) , path, |e| match e {
241- ProjectionElem :: Downcast ( _, idx) => idx == variant,
240+ ProjectionElem :: Downcast ( _, idx) => * idx == variant,
242241 _ => false ,
243242 } )
244243 }
@@ -295,16 +294,16 @@ impl<'b, 'tcx> ElaborateDropsCtxt<'b, 'tcx> {
295294 fn collect_drop_flags ( & mut self ) {
296295 for ( bb, data) in self . body . basic_blocks ( ) . iter_enumerated ( ) {
297296 let terminator = data. terminator ( ) ;
298- let place = match terminator. kind {
299- TerminatorKind :: Drop { ref place , .. }
300- | TerminatorKind :: DropAndReplace { ref place , .. } => place ,
297+ let location = match terminator. kind {
298+ TerminatorKind :: Drop { ref location , .. }
299+ | TerminatorKind :: DropAndReplace { ref location , .. } => location ,
301300 _ => continue ,
302301 } ;
303302
304303 self . init_data . seek_before ( self . body . terminator_loc ( bb) ) ;
305304
306- let path = self . move_data ( ) . rev_lookup . find ( place . as_ref ( ) ) ;
307- debug ! ( "collect_drop_flags: {:?}, place {:?} ({:?})" , bb, place , path) ;
305+ let path = self . move_data ( ) . rev_lookup . find ( location . as_ref ( ) ) ;
306+ debug ! ( "collect_drop_flags: {:?}, place {:?} ({:?})" , bb, location , path) ;
308307
309308 let path = match path {
310309 LookupResult :: Exact ( e) => e,
@@ -316,7 +315,7 @@ impl<'b, 'tcx> ElaborateDropsCtxt<'b, 'tcx> {
316315 terminator. source_info. span,
317316 "drop of untracked, uninitialized value {:?}, place {:?} ({:?})" ,
318317 bb,
319- place ,
318+ location ,
320319 path
321320 ) ;
322321 }
@@ -329,7 +328,7 @@ impl<'b, 'tcx> ElaborateDropsCtxt<'b, 'tcx> {
329328 debug ! (
330329 "collect_drop_flags: collecting {:?} from {:?}@{:?} - {:?}" ,
331330 child,
332- place ,
331+ location ,
333332 path,
334333 ( maybe_live, maybe_dead)
335334 ) ;
@@ -347,13 +346,13 @@ impl<'b, 'tcx> ElaborateDropsCtxt<'b, 'tcx> {
347346
348347 let resume_block = self . patch . resume_block ( ) ;
349348 match terminator. kind {
350- TerminatorKind :: Drop { place , target, unwind } => {
349+ TerminatorKind :: Drop { location , target, unwind } => {
351350 self . init_data . seek_before ( loc) ;
352- match self . move_data ( ) . rev_lookup . find ( place . as_ref ( ) ) {
351+ match self . move_data ( ) . rev_lookup . find ( location . as_ref ( ) ) {
353352 LookupResult :: Exact ( path) => elaborate_drop (
354353 & mut Elaborator { ctxt : self } ,
355354 terminator. source_info ,
356- place ,
355+ location ,
357356 path,
358357 target,
359358 if data. is_cleanup {
@@ -372,10 +371,10 @@ impl<'b, 'tcx> ElaborateDropsCtxt<'b, 'tcx> {
372371 }
373372 }
374373 }
375- TerminatorKind :: DropAndReplace { place , ref value, target, unwind } => {
374+ TerminatorKind :: DropAndReplace { location , ref value, target, unwind } => {
376375 assert ! ( !data. is_cleanup) ;
377376
378- self . elaborate_replace ( loc, place , value, target, unwind) ;
377+ self . elaborate_replace ( loc, location , value, target, unwind) ;
379378 }
380379 _ => continue ,
381380 }
@@ -397,7 +396,7 @@ impl<'b, 'tcx> ElaborateDropsCtxt<'b, 'tcx> {
397396 fn elaborate_replace (
398397 & mut self ,
399398 loc : Location ,
400- place : Place < ' tcx > ,
399+ location : Place < ' tcx > ,
401400 value : & Operand < ' tcx > ,
402401 target : BasicBlock ,
403402 unwind : Option < BasicBlock > ,
@@ -408,7 +407,7 @@ impl<'b, 'tcx> ElaborateDropsCtxt<'b, 'tcx> {
408407 assert ! ( !data. is_cleanup, "DropAndReplace in unwind path not supported" ) ;
409408
410409 let assign = Statement {
411- kind : StatementKind :: Assign ( box ( place , Rvalue :: Use ( value. clone ( ) ) ) ) ,
410+ kind : StatementKind :: Assign ( box ( location , Rvalue :: Use ( value. clone ( ) ) ) ) ,
412411 source_info : terminator. source_info ,
413412 } ;
414413
@@ -428,14 +427,14 @@ impl<'b, 'tcx> ElaborateDropsCtxt<'b, 'tcx> {
428427 is_cleanup : false ,
429428 } ) ;
430429
431- match self . move_data ( ) . rev_lookup . find ( place . as_ref ( ) ) {
430+ match self . move_data ( ) . rev_lookup . find ( location . as_ref ( ) ) {
432431 LookupResult :: Exact ( path) => {
433432 debug ! ( "elaborate_drop_and_replace({:?}) - tracked {:?}" , terminator, path) ;
434433 self . init_data . seek_before ( loc) ;
435434 elaborate_drop (
436435 & mut Elaborator { ctxt : self } ,
437436 terminator. source_info ,
438- place ,
437+ location ,
439438 path,
440439 target,
441440 Unwind :: To ( unwind) ,
@@ -460,7 +459,7 @@ impl<'b, 'tcx> ElaborateDropsCtxt<'b, 'tcx> {
460459 debug ! ( "elaborate_drop_and_replace({:?}) - untracked {:?}" , terminator, parent) ;
461460 self . patch . patch_terminator (
462461 bb,
463- TerminatorKind :: Drop { place , target, unwind : Some ( unwind) } ,
462+ TerminatorKind :: Drop { location , target, unwind : Some ( unwind) } ,
464463 ) ;
465464 }
466465 }
0 commit comments