From 2db3ef10fe8becfa47a6f3edc9b8a51a01125a06 Mon Sep 17 00:00:00 2001 From: Zalathar Date: Wed, 17 Apr 2024 19:31:30 +1000 Subject: [PATCH] Move confusing comment about otherwise blocks in `lower_match_tree` This comment was historically inside a block guarded by `if let Some(otherwise_block) = otherwise`. When #120978 made the otherwise block non-optional, it also flattened that region of code. Doing so left this comment awkwardly stranded aboven an unrelated line of code, without its original context. We can restore that context by moving it above the declaration of `otherwise`. --- compiler/rustc_mir_build/src/build/matches/mod.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/compiler/rustc_mir_build/src/build/matches/mod.rs b/compiler/rustc_mir_build/src/build/matches/mod.rs index 367c391b45a49..3e1cae045e8dd 100644 --- a/compiler/rustc_mir_build/src/build/matches/mod.rs +++ b/compiler/rustc_mir_build/src/build/matches/mod.rs @@ -385,15 +385,15 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { let fake_borrows = match_has_guard .then(|| util::FakeBorrowCollector::collect_fake_borrows(self, candidates)); + // See the doc comment on `match_candidates` for why we have an + // otherwise block. Match checking will ensure this is actually + // unreachable. let otherwise_block = self.cfg.start_new_block(); // This will generate code to test scrutinee_place and // branch to the appropriate arm block self.match_candidates(match_start_span, scrutinee_span, block, otherwise_block, candidates); - // See the doc comment on `match_candidates` for why we may have an - // otherwise block. Match checking will ensure this is actually - // unreachable. let source_info = self.source_info(scrutinee_span); // Matching on a `scrutinee_place` with an uninhabited type doesn't