Skip to content

Commit 581b197

Browse files
nikomatsakisNashenas88
authored andcommitted
WIP add a bunch of debug statements
1 parent 49d53da commit 581b197

File tree

1 file changed

+20
-7
lines changed

1 file changed

+20
-7
lines changed

src/librustc_mir/borrow_check/nll/constraint_generation.rs

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ use rustc_data_structures::fx::FxHashSet;
2323
use syntax::codemap::DUMMY_SP;
2424
use borrow_check::FlowInProgress;
2525
use dataflow::MaybeInitializedLvals;
26-
use dataflow::move_paths::MoveData;
26+
use dataflow::move_paths::{MoveData, HasMoveData};
2727

2828
use super::LivenessResults;
2929
use super::ToRegionVid;
@@ -88,24 +88,37 @@ impl<'cx, 'cg, 'gcx, 'tcx> ConstraintGeneration<'cx, 'cg, 'gcx, 'tcx> {
8888
self.liveness.drop.simulate_block(self.mir, bb, |location, live_locals| {
8989
all_live_locals.push((location, live_locals.iter().collect()));
9090
});
91+
debug!("add_liveness_constraints: all_live_locals={:#?}", all_live_locals);
9192

9293
let terminator_index = self.mir.basic_blocks()[bb].statements.len();
9394
self.flow_inits.reset_to_entry_of(bb);
9495
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-
10096
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+
101105
let mpi = self.move_data.rev_lookup.find_local(live_local);
102106
if self.flow_inits.has_any_child_of(mpi).is_some() {
107+
debug!("add_liveness_constraints: mpi={:?} has initialization children", mpi);
103108
let live_local_ty = self.mir.local_decls[live_local].ty;
104109
self.add_drop_live_constraint(live_local_ty, location);
110+
} else {
111+
debug!("add_liveness_constraints: mpi={:?} has no initialized children", mpi);
105112
}
106113
}
107114

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+
}
109122
}
110123
}
111124
}

0 commit comments

Comments
 (0)