Skip to content

Commit 561ea0a

Browse files
authored
Rollup merge of rust-lang#99110 - audunhalland:match_has_guard_from_candidate, r=pnkfelix
Determine match_has_guard from candidates instead of looking up thir table again Currently looking through mir build of matches because of interest in deref patterns. Finding some micro-optimizable things.
2 parents dfddc2f + 2036aea commit 561ea0a

File tree

1 file changed

+1
-1
lines changed
  • compiler/rustc_mir_build/src/build/matches

1 file changed

+1
-1
lines changed

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
170170

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

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

0 commit comments

Comments
 (0)