@@ -7,6 +7,7 @@ use rustc_middle::mir::{
77
88use super :: visitor:: ResultsVisitor ;
99use super :: { Analysis , Effect , EffectIndex } ;
10+ use crate :: Results ;
1011
1112pub trait Direction {
1213 const IS_FORWARD : bool ;
@@ -40,7 +41,7 @@ pub trait Direction {
4041 /// all locations in a basic block (starting from `entry_state` and to
4142 /// visit them with `vis`.
4243 fn visit_results_in_block < ' mir , ' tcx , A > (
43- analysis : & A ,
44+ results : & Results < ' tcx , A > ,
4445 state : & mut A :: Domain ,
4546 block : BasicBlock ,
4647 block_data : & ' mir mir:: BasicBlockData < ' tcx > ,
@@ -206,32 +207,32 @@ impl Direction for Backward {
206207 }
207208
208209 fn visit_results_in_block < ' mir , ' tcx , A > (
209- analysis : & A ,
210+ results : & Results < ' tcx , A > ,
210211 state : & mut A :: Domain ,
211212 block : BasicBlock ,
212213 block_data : & ' mir mir:: BasicBlockData < ' tcx > ,
213214 vis : & mut impl ResultsVisitor < ' tcx , A > ,
214215 ) where
215216 A : Analysis < ' tcx > ,
216217 {
217- vis. visit_block_end ( state) ;
218+ vis. visit_block_end ( results , state, block ) ;
218219
219220 let loc = Location { block, statement_index : block_data. statements . len ( ) } ;
220221 let term = block_data. terminator ( ) ;
221- analysis. apply_early_terminator_effect ( state, term, loc) ;
222- vis. visit_after_early_terminator_effect ( analysis, state, term, loc) ;
223- analysis. apply_primary_terminator_effect ( state, term, loc) ;
224- vis. visit_after_primary_terminator_effect ( analysis, state, term, loc) ;
222+ results . analysis . apply_early_terminator_effect ( state, term, loc) ;
223+ vis. visit_after_early_terminator_effect ( & results . analysis , state, term, loc) ;
224+ results . analysis . apply_primary_terminator_effect ( state, term, loc) ;
225+ vis. visit_after_primary_terminator_effect ( & results . analysis , state, term, loc) ;
225226
226227 for ( statement_index, stmt) in block_data. statements . iter ( ) . enumerate ( ) . rev ( ) {
227228 let loc = Location { block, statement_index } ;
228- analysis. apply_early_statement_effect ( state, stmt, loc) ;
229- vis. visit_after_early_statement_effect ( analysis, state, stmt, loc) ;
230- analysis. apply_primary_statement_effect ( state, stmt, loc) ;
231- vis. visit_after_primary_statement_effect ( analysis, state, stmt, loc) ;
229+ results . analysis . apply_early_statement_effect ( state, stmt, loc) ;
230+ vis. visit_after_early_statement_effect ( & results . analysis , state, stmt, loc) ;
231+ results . analysis . apply_primary_statement_effect ( state, stmt, loc) ;
232+ vis. visit_after_primary_statement_effect ( & results . analysis , state, stmt, loc) ;
232233 }
233234
234- vis. visit_block_start ( state) ;
235+ vis. visit_block_start ( results , state, block ) ;
235236 }
236237}
237238
@@ -386,31 +387,31 @@ impl Direction for Forward {
386387 }
387388
388389 fn visit_results_in_block < ' mir , ' tcx , A > (
389- analysis : & A ,
390+ results : & Results < ' tcx , A > ,
390391 state : & mut A :: Domain ,
391392 block : BasicBlock ,
392393 block_data : & ' mir mir:: BasicBlockData < ' tcx > ,
393394 vis : & mut impl ResultsVisitor < ' tcx , A > ,
394395 ) where
395396 A : Analysis < ' tcx > ,
396397 {
397- vis. visit_block_start ( state) ;
398+ vis. visit_block_start ( results , state, block ) ;
398399
399400 for ( statement_index, stmt) in block_data. statements . iter ( ) . enumerate ( ) {
400401 let loc = Location { block, statement_index } ;
401- analysis. apply_early_statement_effect ( state, stmt, loc) ;
402- vis. visit_after_early_statement_effect ( analysis, state, stmt, loc) ;
403- analysis. apply_primary_statement_effect ( state, stmt, loc) ;
404- vis. visit_after_primary_statement_effect ( analysis, state, stmt, loc) ;
402+ results . analysis . apply_early_statement_effect ( state, stmt, loc) ;
403+ vis. visit_after_early_statement_effect ( & results . analysis , state, stmt, loc) ;
404+ results . analysis . apply_primary_statement_effect ( state, stmt, loc) ;
405+ vis. visit_after_primary_statement_effect ( & results . analysis , state, stmt, loc) ;
405406 }
406407
407408 let loc = Location { block, statement_index : block_data. statements . len ( ) } ;
408409 let term = block_data. terminator ( ) ;
409- analysis. apply_early_terminator_effect ( state, term, loc) ;
410- vis. visit_after_early_terminator_effect ( analysis, state, term, loc) ;
411- analysis. apply_primary_terminator_effect ( state, term, loc) ;
412- vis. visit_after_primary_terminator_effect ( analysis, state, term, loc) ;
410+ results . analysis . apply_early_terminator_effect ( state, term, loc) ;
411+ vis. visit_after_early_terminator_effect ( & results . analysis , state, term, loc) ;
412+ results . analysis . apply_primary_terminator_effect ( state, term, loc) ;
413+ vis. visit_after_primary_terminator_effect ( & results . analysis , state, term, loc) ;
413414
414- vis. visit_block_end ( state) ;
415+ vis. visit_block_end ( results , state, block ) ;
415416 }
416417}
0 commit comments