Skip to content

Commit

Permalink
Determine match_has_guard from candidates instead of looking up thir …
Browse files Browse the repository at this point in the history
…table again
  • Loading branch information
audunhalland committed Jul 10, 2022
1 parent f893495 commit 2036aea
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion compiler/rustc_mir_build/src/build/matches/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {

let mut arm_candidates = self.create_match_candidates(scrutinee_place.clone(), &arms);

let match_has_guard = arms.iter().copied().any(|arm| self.thir[arm].guard.is_some());
let match_has_guard = arm_candidates.iter().any(|(_, candidate)| candidate.has_guard);
let mut candidates =
arm_candidates.iter_mut().map(|(_, candidate)| candidate).collect::<Vec<_>>();

Expand Down

0 comments on commit 2036aea

Please sign in to comment.