From 8467a7b33ebdb0c8641e80c9c36bb098a93a7547 Mon Sep 17 00:00:00 2001 From: Ding Xiang Fei Date: Sun, 31 Jul 2022 20:37:30 +0800 Subject: [PATCH] provide a clearer explanation of scope breaking --- compiler/rustc_mir_build/src/build/block.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/compiler/rustc_mir_build/src/build/block.rs b/compiler/rustc_mir_build/src/build/block.rs index c52a7b187d519..280b6aad12c0a 100644 --- a/compiler/rustc_mir_build/src/build/block.rs +++ b/compiler/rustc_mir_build/src/build/block.rs @@ -84,8 +84,10 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { let mut let_scope_stack = Vec::with_capacity(8); let outer_source_scope = this.source_scope; let outer_in_scope_unsafe = this.in_scope_unsafe; - // This scope information is kept for breaking out of the current block in case + // This scope information is kept for breaking out of the parent remainder scope in case // one let-else pattern matching fails. + // By doing so, we can be sure that even temporaries that receive extended lifetime + // assignments are dropped, too. let mut last_remainder_scope = region_scope; this.update_source_scope_for_safety_mode(span, safety_mode);