From 563152d8830737b65d39d280214b1a64aa006f98 Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Wed, 8 Apr 2020 14:49:57 +0000 Subject: [PATCH] comment pessimistic yield and saving/restoring state --- src/librustc_passes/region.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/librustc_passes/region.rs b/src/librustc_passes/region.rs index 1807756fe524b..32e7e8843a07c 100644 --- a/src/librustc_passes/region.rs +++ b/src/librustc_passes/region.rs @@ -717,9 +717,16 @@ impl<'tcx> Visitor<'tcx> for RegionResolutionVisitor<'tcx> { self.cx.parent ); + // Save all state that is specific to the outer function + // body. These will be restored once down below, once we've + // visited the body. let outer_ec = mem::replace(&mut self.expr_and_pat_count, 0); let outer_cx = self.cx; let outer_ts = mem::take(&mut self.terminating_scopes); + // The 'pessimistic yield' flag is set to true when we are + // processing a `+=` statement and have to make pessimistic + // control flow assumptions. This doesn't apply to nested + // bodies within the `+=` statements. See #69307. let outer_pessimistic_yield = mem::replace(&mut self.pessimistic_yield, false); self.terminating_scopes.insert(body.value.hir_id.local_id);