@@ -391,14 +391,15 @@ impl<'tcx> Analysis<'tcx> for MaybeInitializedPlaces<'_, 'tcx> {
391391 }
392392 }
393393
394- fn apply_primary_terminator_effect < ' mir > (
394+ fn get_terminator_edges < ' mir > (
395395 & self ,
396- state : & mut Self :: Domain ,
396+ state : & Self :: Domain ,
397397 terminator : & ' mir mir:: Terminator < ' tcx > ,
398- location : Location ,
398+ _location : Location ,
399399 ) -> TerminatorEdges < ' mir , ' tcx > {
400- // Note: `edges` must be computed first because `drop_flag_effects_for_location` can change
401- // the result of `is_unwind_dead`.
400+ // Note: this relies on `get_terminator_edges` being called before
401+ // `apply_primary_terminator_effect` because the result of `is_unwind_dead` is affected by
402+ // the `drop_flag_effects_for_location` in `apply_primary_terminator_effect`.
402403 let mut edges = terminator. edges ( ) ;
403404 if self . skip_unreachable_unwind
404405 && let mir:: TerminatorKind :: Drop { target, unwind, place, replace : _, drop : _ } =
@@ -408,10 +409,18 @@ impl<'tcx> Analysis<'tcx> for MaybeInitializedPlaces<'_, 'tcx> {
408409 {
409410 edges = TerminatorEdges :: Single ( target) ;
410411 }
412+ edges
413+ }
414+
415+ fn apply_primary_terminator_effect (
416+ & self ,
417+ state : & mut Self :: Domain ,
418+ _terminator : & mir:: Terminator < ' tcx > ,
419+ location : Location ,
420+ ) {
411421 drop_flag_effects_for_location ( self . body , self . move_data , location, |path, s| {
412422 Self :: update_bits ( state, path, s)
413423 } ) ;
414- edges
415424 }
416425
417426 fn apply_call_return_effect (
@@ -514,15 +523,12 @@ impl<'tcx> Analysis<'tcx> for MaybeUninitializedPlaces<'_, 'tcx> {
514523 // mutable borrow occurs. Places cannot become uninitialized through a mutable reference.
515524 }
516525
517- fn apply_primary_terminator_effect < ' mir > (
526+ fn get_terminator_edges < ' mir > (
518527 & self ,
519- state : & mut Self :: Domain ,
528+ _state : & Self :: Domain ,
520529 terminator : & ' mir mir:: Terminator < ' tcx > ,
521530 location : Location ,
522531 ) -> TerminatorEdges < ' mir , ' tcx > {
523- drop_flag_effects_for_location ( self . body , self . move_data , location, |path, s| {
524- Self :: update_bits ( state, path, s)
525- } ) ;
526532 if self . skip_unreachable_unwind . contains ( location. block ) {
527533 let mir:: TerminatorKind :: Drop { target, unwind, .. } = terminator. kind else { bug ! ( ) } ;
528534 assert_matches ! ( unwind, mir:: UnwindAction :: Cleanup ( _) ) ;
@@ -532,6 +538,17 @@ impl<'tcx> Analysis<'tcx> for MaybeUninitializedPlaces<'_, 'tcx> {
532538 }
533539 }
534540
541+ fn apply_primary_terminator_effect (
542+ & self ,
543+ state : & mut Self :: Domain ,
544+ _terminator : & mir:: Terminator < ' tcx > ,
545+ location : Location ,
546+ ) {
547+ drop_flag_effects_for_location ( self . body , self . move_data , location, |path, s| {
548+ Self :: update_bits ( state, path, s)
549+ } ) ;
550+ }
551+
535552 fn apply_call_return_effect (
536553 & self ,
537554 state : & mut Self :: Domain ,
@@ -633,13 +650,13 @@ impl<'tcx> Analysis<'tcx> for EverInitializedPlaces<'_, 'tcx> {
633650 }
634651 }
635652
636- #[ instrument( skip( self , state, terminator ) , level = "debug" ) ]
637- fn apply_primary_terminator_effect < ' mir > (
653+ #[ instrument( skip( self , state, _terminator ) , level = "debug" ) ]
654+ fn apply_primary_terminator_effect (
638655 & self ,
639656 state : & mut Self :: Domain ,
640- terminator : & ' mir mir:: Terminator < ' tcx > ,
657+ _terminator : & mir:: Terminator < ' tcx > ,
641658 location : Location ,
642- ) -> TerminatorEdges < ' mir , ' tcx > {
659+ ) {
643660 let move_data = self . move_data ( ) ;
644661 let init_loc_map = & move_data. init_loc_map ;
645662
@@ -652,7 +669,6 @@ impl<'tcx> Analysis<'tcx> for EverInitializedPlaces<'_, 'tcx> {
652669 None
653670 }
654671 } ) ) ;
655- terminator. edges ( )
656672 }
657673
658674 fn apply_call_return_effect (
0 commit comments