From 90da274958a21e92d974a095d1dbc279d42de0c3 Mon Sep 17 00:00:00 2001 From: Dylan MacKenzie Date: Wed, 6 May 2020 12:40:25 -0700 Subject: [PATCH] Add comment explaining the extra `record_conflicts` --- src/librustc_mir/transform/generator.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/librustc_mir/transform/generator.rs b/src/librustc_mir/transform/generator.rs index 60d2e865d6b..0d4ca6e7689 100644 --- a/src/librustc_mir/transform/generator.rs +++ b/src/librustc_mir/transform/generator.rs @@ -622,6 +622,10 @@ 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. trace!("record conflicts at end of {:?}", block); init.seek_to_block_end(block); borrowed.seek_to_block_end(block);