diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2024-04-18 08:37:49 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-04-18 08:37:49 +0200 |
| commit | 2c7ef790652fcdc90bdd75e4e49026bec44c14b7 (patch) | |
| tree | 5c7620e7c96221aff2a49dfaae0beb15924d440b | |
| parent | 7add0bdf7e8dbe45a9caa6027547e4351b9ab9f5 (diff) | |
| parent | d3c30519956ca989f64f53410cdb95e22913e942 (diff) | |
| download | rust-2c7ef790652fcdc90bdd75e4e49026bec44c14b7.tar.gz rust-2c7ef790652fcdc90bdd75e4e49026bec44c14b7.zip | |
Rollup merge of #124064 - Zalathar:otherwise-block, r=Nadrieril
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 above an unrelated line of code, without its original context. We can restore that context by moving it above the declaration of `otherwise`. r? ``@Nadrieril``
| -rw-r--r-- | compiler/rustc_mir_build/src/build/matches/mod.rs | 6 |
1 files 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 3228fe25ac1..9730473c428 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 |
