about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorDylan MacKenzie <ecstaticmorse@gmail.com>2020-05-08 10:20:51 -0700
committerDylan MacKenzie <ecstaticmorse@gmail.com>2020-05-19 17:52:08 -0700
commitdef207e262a6a2ea0bc4b9607e2b8a7a952d0799 (patch)
tree205fa95ffb335f6068613253bfb88edff5330503 /src
parentd8e0807052b5e90b8d4d049d90b6325137244042 (diff)
downloadrust-def207e262a6a2ea0bc4b9607e2b8a7a952d0799.tar.gz
rust-def207e262a6a2ea0bc4b9607e2b8a7a952d0799.zip
Look for storage conflicts before terminator effect
Diffstat (limited to 'src')
-rw-r--r--src/librustc_mir/transform/generator.rs11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/librustc_mir/transform/generator.rs b/src/librustc_mir/transform/generator.rs
index 3920057d31e..bee129b8749 100644
--- a/src/librustc_mir/transform/generator.rs
+++ b/src/librustc_mir/transform/generator.rs
@@ -615,7 +615,9 @@ fn compute_storage_conflicts(
             continue;
         }
 
-        for (statement_index, _) in data.statements.iter().enumerate() {
+        // Observe the dataflow state *before* all possible locations (statement or terminator) in
+        // each basic block...
+        for statement_index in 0..=data.statements.len() {
             let loc = Location { block, statement_index };
             trace!("record conflicts at {:?}", loc);
             init.seek_before_primary_effect(loc);
@@ -623,10 +625,9 @@ fn compute_storage_conflicts(
             record_conflicts_at_curr_loc(&mut local_conflicts, &init, &borrowed);
         }
 
-        // We need to look for conflicts at the end of the block as well, otherwise we would not
-        // observe the dataflow state after the terminator effect is applied. As long as neither
-        // `init` nor `borrowed` has a "before" effect, we will observe all possible dataflow
-        // states here or in the loop above.
+        // ...and then observe the state *after* the terminator effect is applied. As long as
+        // neither `init` nor `borrowed` has a "before" effect, we will observe all possible
+        // dataflow states here or in the loop above.
         trace!("record conflicts at end of {:?}", block);
         init.seek_to_block_end(block);
         borrowed.seek_to_block_end(block);