Skip to content

Commit 49d53da

Browse files
committed
Simplify drop loop and account for terminators
1 parent ef236e4 commit 49d53da

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/librustc_mir/borrow_check/nll/constraint_generation.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,13 @@ impl<'cx, 'cg, 'gcx, 'tcx> ConstraintGeneration<'cx, 'cg, 'gcx, 'tcx> {
8989
all_live_locals.push((location, live_locals.iter().collect()));
9090
});
9191

92+
let terminator_index = self.mir.basic_blocks()[bb].statements.len();
9293
self.flow_inits.reset_to_entry_of(bb);
93-
for index in 0 .. self.mir.basic_blocks()[bb].statements.len() {
94-
let location = Location { block: bb, statement_index: index };
95-
let (location2, live_locals) = all_live_locals.pop().unwrap();
96-
assert_eq!(location, location2);
94+
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+
}
9799

98100
for live_local in live_locals {
99101
let mpi = self.move_data.rev_lookup.find_local(live_local);

0 commit comments

Comments
 (0)