Skip to content

Commit 67220bb

Browse files
committed
Fix some comments
1 parent 463dbdf commit 67220bb

File tree

4 files changed

+12
-13
lines changed

4 files changed

+12
-13
lines changed

compiler/rustc_mir_build/src/builder/expr/into.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
259259
this.cfg.goto(block, source_info, loop_block);
260260

261261
this.in_breakable_scope(Some(loop_block), destination, expr_span, |this| {
262-
// logic for `loop`
262+
// Logic for `loop`.
263263
let mut body_block = this.cfg.start_new_block();
264264
this.cfg.terminate(
265265
loop_block,
@@ -303,12 +303,12 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
303303

304304
let state_place = scrutinee_place_builder.to_place(this);
305305

306-
// this is logic for the labeled block: a block is a drop scope, hence
306+
// This is logic for the labeled block: a block is a drop scope, hence
307307
// `in_scope`, and a labeled block can be broken out of with a `break 'label`,
308308
// hence the `in_breakable_scope`.
309309
//
310-
// Inside of that information for #[const_continue] is stored, and the match is
311-
// lowered in the standard way.
310+
// Then `in_const_continuable_scope` stores information for the lowering of
311+
// #[const_continue], and finally the match is lowered in the standard way.
312312
unpack!(
313313
body_block = this.in_scope(
314314
(region_scope, source_info),

compiler/rustc_mir_build/src/builder/matches/mod.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2881,8 +2881,9 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
28812881

28822882
if let rustc_pattern_analysis::rustc::Constructor::Or = pat.ctor() {
28832883
for pat in pat.iter_fields() {
2884-
// when the bindings are the same, the sub_branch is only stored once,
2885-
// so we must repeat it manually.
2884+
// For top-level or-patterns (the only ones we accept right now), when the
2885+
// bindings are the same (e.g. there are none), the sub_branch is stored just
2886+
// once.
28862887
let sub_branch = branch
28872888
.sub_branches
28882889
.get(pat.idx)

compiler/rustc_mir_build/src/builder/scope.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -181,10 +181,10 @@ struct BreakableScope<'tcx> {
181181

182182
#[derive(Debug)]
183183
struct ConstContinuableScope<'tcx> {
184-
/// The if-then scope or arm scope
184+
/// The if-then scope or arm scope.
185185
region_scope: region::Scope,
186186
/// The destination of the loop/block expression itself (i.e., where to put
187-
/// the result of a `break` or `return` expression)
187+
/// the result of a `break` or `return` expression).
188188
state_place: Place<'tcx>,
189189

190190
arms: Box<[ArmId]>,
@@ -574,7 +574,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
574574
}
575575
}
576576

577-
/// Start a const-continuable scope, which tracks where `#[const_continue] break` should
577+
/// Start a const-continuable scope, which tracks where `#[const_continue] break` should
578578
/// branch to.
579579
pub(crate) fn in_const_continuable_scope<F>(
580580
&mut self,
@@ -849,7 +849,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
849849
_ => todo!(),
850850
};
851851

852-
// the PatCtxt is normally used in pattern exhaustiveness checking, but reused here
852+
// The PatCtxt is normally used in pattern exhaustiveness checking, but reused here
853853
// because it performs normalization and const evaluation.
854854
let dropless_arena = rustc_arena::DroplessArena::default();
855855
let typeck_results = self.tcx.typeck(self.def_id);
@@ -903,8 +903,6 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
903903

904904
self.cfg.terminate(imaginary_target, source_info, TerminatorKind::UnwindResume);
905905

906-
// FIXME add to drop tree for loop_head
907-
908906
let region_scope = scope.region_scope;
909907
let scope_index = self.scopes.scope_index(region_scope, span);
910908
let mut drops = DropTree::new();

compiler/rustc_passes/src/loops.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ enum Context {
3939
AnonConst,
4040
/// E.g. `const { ... }`.
4141
ConstBlock,
42-
/// #[loop_match] loop { state = 'label: { /* ... */ } }
42+
/// `#[loop_match] loop { state = 'label: { /* ... */ } }`
4343
LoopMatch {
4444
/// The label of the labeled block (so not the loop!)
4545
labeled_block: Label,

0 commit comments

Comments
 (0)