Skip to content

Commit f294773

Browse files
committed
fix docs for ConstContinuableScope
1 parent 4f0957b commit f294773

File tree

1 file changed

+14
-11
lines changed
  • compiler/rustc_mir_build/src/builder

1 file changed

+14
-11
lines changed

compiler/rustc_mir_build/src/builder/scope.rs

+14-11
Original file line numberDiff line numberDiff line change
@@ -180,17 +180,16 @@ struct BreakableScope<'tcx> {
180180

181181
#[derive(Debug)]
182182
struct ConstContinuableScope<'tcx> {
183-
/// The if-then scope or arm scope.
183+
/// The scope for the `#[loop_match]` which its `#[const_continue]`s will jump to.
184184
region_scope: region::Scope,
185-
/// The destination of the loop/block expression itself (i.e., where to put
186-
/// the result of a `break` or `return` expression).
185+
/// The place of the state of a `#[loop_match]`, which a `#[const_continue]` must update.
187186
state_place: Place<'tcx>,
188187

189188
arms: Box<[ArmId]>,
190189
built_match_tree: BuiltMatchTree<'tcx>,
191190

192-
/// Drops that happen on the `return` path and would have happened on the `break` path.
193-
break_drops: DropTree,
191+
/// Drops that happen on a `#[const_continue]`
192+
const_continue_drops: DropTree,
194193
}
195194

196195
#[derive(Debug)]
@@ -588,17 +587,21 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
588587
let scope = ConstContinuableScope {
589588
region_scope,
590589
state_place,
591-
break_drops: DropTree::new(),
590+
const_continue_drops: DropTree::new(),
592591
arms,
593592
built_match_tree,
594593
};
595594
self.scopes.const_continuable_scopes.push(scope);
596595
let normal_exit_block = f(self);
597-
let breakable_scope = self.scopes.const_continuable_scopes.pop().unwrap();
598-
assert!(breakable_scope.region_scope == region_scope);
596+
let const_continue_scope = self.scopes.const_continuable_scopes.pop().unwrap();
597+
assert!(const_continue_scope.region_scope == region_scope);
599598

600-
let break_block =
601-
self.build_exit_tree(breakable_scope.break_drops, region_scope, span, None);
599+
let break_block = self.build_exit_tree(
600+
const_continue_scope.const_continue_drops,
601+
region_scope,
602+
span,
603+
None,
604+
);
602605

603606
match (normal_exit_block, break_block) {
604607
(block, None) => block,
@@ -889,7 +892,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
889892
TerminatorKind::FalseEdge { real_target: drop_and_continue_block, imaginary_target },
890893
);
891894

892-
let drops = &mut scope.break_drops;
895+
let drops = &mut scope.const_continue_drops;
893896

894897
let drop_idx = self.scopes.scopes[scope_index + 1..]
895898
.iter()

0 commit comments

Comments
 (0)