Skip to content

Commit 0a09ae6

Browse files
committed
[MIR] Make sure candidates are reversed before match_candidates.
1 parent 4ce1daf commit 0a09ae6

File tree

1 file changed

+4
-1
lines changed
  • src/librustc_mir/build/matches

1 file changed

+4
-1
lines changed

src/librustc_mir/build/matches/mod.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,10 @@ impl<'a,'tcx> Builder<'a,'tcx> {
512512
let otherwise: Vec<_> =
513513
target_blocks.into_iter()
514514
.zip(target_candidates)
515-
.flat_map(|(target_block, target_candidates)| {
515+
.flat_map(|(target_block, mut target_candidates)| {
516+
// We need to preserve the fact that the candidates
517+
// are in the reversed order compared to the source.
518+
target_candidates.reverse();
516519
self.match_candidates(span,
517520
arm_blocks,
518521
target_candidates,

0 commit comments

Comments
 (0)