Skip to content

Commit

Permalink
typecheck guard pattern conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
max-niederman committed Sep 15, 2024
1 parent cb2e54e commit 4d64bb4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion compiler/rustc_hir_typeck/src/pat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -259,8 +259,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
PatKind::Struct(ref qpath, fields, has_rest_pat) => {
self.check_pat_struct(pat, qpath, fields, has_rest_pat, expected, pat_info)
}
PatKind::Guard(pat, _) => {
PatKind::Guard(pat, cond) => {
self.check_pat(pat, expected, pat_info);
self.check_expr_has_type_or_error(cond, self.tcx.types.bool, |_| {});
expected
}
PatKind::Or(pats) => {
Expand Down

0 comments on commit 4d64bb4

Please sign in to comment.