@@ -23,7 +23,7 @@ use rustc_data_structures::fx::FxHashSet;
23
23
use syntax:: codemap:: DUMMY_SP ;
24
24
use borrow_check:: FlowInProgress ;
25
25
use dataflow:: MaybeInitializedLvals ;
26
- use dataflow:: move_paths:: MoveData ;
26
+ use dataflow:: move_paths:: { MoveData , HasMoveData } ;
27
27
28
28
use super :: LivenessResults ;
29
29
use super :: ToRegionVid ;
@@ -88,24 +88,37 @@ impl<'cx, 'cg, 'gcx, 'tcx> ConstraintGeneration<'cx, 'cg, 'gcx, 'tcx> {
88
88
self . liveness . drop . simulate_block ( self . mir , bb, |location, live_locals| {
89
89
all_live_locals. push ( ( location, live_locals. iter ( ) . collect ( ) ) ) ;
90
90
} ) ;
91
+ debug ! ( "add_liveness_constraints: all_live_locals={:#?}" , all_live_locals) ;
91
92
92
93
let terminator_index = self . mir . basic_blocks ( ) [ bb] . statements . len ( ) ;
93
94
self . flow_inits . reset_to_entry_of ( bb) ;
94
95
while let Some ( ( location, live_locals) ) = all_live_locals. pop ( ) {
95
- if location. statement_index == terminator_index {
96
- self . flow_inits . reconstruct_terminator_effect ( location) ;
97
- continue ;
98
- }
99
-
100
96
for live_local in live_locals {
97
+ debug ! ( "add_liveness_constraints: location={:?} live_local={:?}" , location, live_local) ;
98
+
99
+ self . flow_inits . each_state_bit ( |mpi_init| {
100
+ debug ! ( "add_liveness_constraints: location={:?} initialized={:?}" ,
101
+ location,
102
+ & self . flow_inits. base_results. operator( ) . move_data( ) . move_paths[ mpi_init] ) ;
103
+ } ) ;
104
+
101
105
let mpi = self . move_data . rev_lookup . find_local ( live_local) ;
102
106
if self . flow_inits . has_any_child_of ( mpi) . is_some ( ) {
107
+ debug ! ( "add_liveness_constraints: mpi={:?} has initialization children" , mpi) ;
103
108
let live_local_ty = self . mir . local_decls [ live_local] . ty ;
104
109
self . add_drop_live_constraint ( live_local_ty, location) ;
110
+ } else {
111
+ debug ! ( "add_liveness_constraints: mpi={:?} has no initialized children" , mpi) ;
105
112
}
106
113
}
107
114
108
- self . flow_inits . reconstruct_statement_effect ( location) ;
115
+ if location. statement_index == terminator_index {
116
+ debug ! ( "add_liveness_constraints: reconstruct_terminator_effect from {:#?}" , location) ;
117
+ self . flow_inits . reconstruct_terminator_effect ( location) ;
118
+ } else {
119
+ debug ! ( "add_liveness_constraints: reconstruct_statement_effect from {:#?}" , location) ;
120
+ self . flow_inits . reconstruct_statement_effect ( location) ;
121
+ }
109
122
}
110
123
}
111
124
}
0 commit comments