Skip to content

Commit ca9f23f

Browse files
authored
Unrolled build for rust-lang#126926
Rollup merge of rust-lang#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 c290e9d + 8016940 commit ca9f23f

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)