Skip to content

Commit def207e

Browse files
Look for storage conflicts before terminator effect
1 parent d8e0807 commit def207e

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/librustc_mir/transform/generator.rs

+6-5
Original file line numberDiff line numberDiff line change
@@ -615,18 +615,19 @@ fn compute_storage_conflicts(
615615
continue;
616616
}
617617

618-
for (statement_index, _) in data.statements.iter().enumerate() {
618+
// Observe the dataflow state *before* all possible locations (statement or terminator) in
619+
// each basic block...
620+
for statement_index in 0..=data.statements.len() {
619621
let loc = Location { block, statement_index };
620622
trace!("record conflicts at {:?}", loc);
621623
init.seek_before_primary_effect(loc);
622624
borrowed.seek_before_primary_effect(loc);
623625
record_conflicts_at_curr_loc(&mut local_conflicts, &init, &borrowed);
624626
}
625627

626-
// We need to look for conflicts at the end of the block as well, otherwise we would not
627-
// observe the dataflow state after the terminator effect is applied. As long as neither
628-
// `init` nor `borrowed` has a "before" effect, we will observe all possible dataflow
629-
// states here or in the loop above.
628+
// ...and then observe the state *after* the terminator effect is applied. As long as
629+
// neither `init` nor `borrowed` has a "before" effect, we will observe all possible
630+
// dataflow states here or in the loop above.
630631
trace!("record conflicts at end of {:?}", block);
631632
init.seek_to_block_end(block);
632633
borrowed.seek_to_block_end(block);

0 commit comments

Comments
 (0)