Skip to content

Commit 4f0957b

Browse files
committed
Fix some comments
1 parent 7c33ba2 commit 4f0957b

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

+4-4
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

+3-2
Original file line numberDiff line numberDiff line change
@@ -2880,8 +2880,9 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
28802880

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

compiler/rustc_mir_build/src/builder/scope.rs

+4-6
Original file line numberDiff line numberDiff line change
@@ -180,10 +180,10 @@ struct BreakableScope<'tcx> {
180180

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

189189
arms: Box<[ArmId]>,
@@ -571,7 +571,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
571571
}
572572
}
573573

574-
/// Start a const-continuable scope, which tracks where `#[const_continue] break` should
574+
/// Start a const-continuable scope, which tracks where `#[const_continue] break` should
575575
/// branch to.
576576
pub(crate) fn in_const_continuable_scope<F>(
577577
&mut self,
@@ -846,7 +846,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
846846
_ => todo!(),
847847
};
848848

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

901901
self.cfg.terminate(imaginary_target, source_info, TerminatorKind::UnwindResume);
902902

903-
// FIXME add to drop tree for loop_head
904-
905903
let region_scope = scope.region_scope;
906904
let scope_index = self.scopes.scope_index(region_scope, span);
907905
let mut drops = DropTree::new();

compiler/rustc_passes/src/loops.rs

+1-1
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)