Skip to content

Commit 563152d

Browse files
committed
comment pessimistic yield and saving/restoring state
1 parent cd9f709 commit 563152d

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/librustc_passes/region.rs

+7
Original file line numberDiff line numberDiff line change
@@ -717,9 +717,16 @@ impl<'tcx> Visitor<'tcx> for RegionResolutionVisitor<'tcx> {
717717
self.cx.parent
718718
);
719719

720+
// Save all state that is specific to the outer function
721+
// body. These will be restored once down below, once we've
722+
// visited the body.
720723
let outer_ec = mem::replace(&mut self.expr_and_pat_count, 0);
721724
let outer_cx = self.cx;
722725
let outer_ts = mem::take(&mut self.terminating_scopes);
726+
// The 'pessimistic yield' flag is set to true when we are
727+
// processing a `+=` statement and have to make pessimistic
728+
// control flow assumptions. This doesn't apply to nested
729+
// bodies within the `+=` statements. See #69307.
723730
let outer_pessimistic_yield = mem::replace(&mut self.pessimistic_yield, false);
724731
self.terminating_scopes.insert(body.value.hir_id.local_id);
725732

0 commit comments

Comments
 (0)