Skip to content

Commit 6077c0e

Browse files
authored
Rollup merge of #126926 - Zalathar:candidate-per-arm, r=Nadrieril
Tweak a confusing comment in `create_match_candidates` This comment was accurate at the time it was written, but various later changes reshuffled things in ways that caused the existing comment to become confusing. I've therefore tried to clarify that *these* candidates are 1:1 with match arms, while also warning that that isn't the case in general.
2 parents e29cc5d + 8016940 commit 6077c0e

File tree

1 file changed

+5
-2
lines changed
  • compiler/rustc_mir_build/src/build/matches

1 file changed

+5
-2
lines changed

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

+5-2
Original file line numberDiff line numberDiff line change
@@ -358,8 +358,11 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
358358
where
359359
'a: 'pat,
360360
{
361-
// Assemble a list of candidates: there is one candidate per pattern,
362-
// which means there may be more than one candidate *per arm*.
361+
// Assemble the initial list of candidates. These top-level candidates
362+
// are 1:1 with the original match arms, but other parts of match
363+
// lowering also introduce subcandidates (for subpatterns), and will
364+
// also flatten candidates in some cases. So in general a list of
365+
// candidates does _not_ necessarily correspond to a list of arms.
363366
arms.iter()
364367
.copied()
365368
.map(|arm| {

0 commit comments

Comments
 (0)