Skip to content

Commit 087b872

Browse files
committed
typecheck guard pattern conditions
1 parent b579c36 commit 087b872

File tree

1 file changed

+2
-1
lines changed
  • compiler/rustc_hir_typeck/src

1 file changed

+2
-1
lines changed

Diff for: compiler/rustc_hir_typeck/src/pat.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -284,8 +284,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
284284
PatKind::Struct(ref qpath, fields, has_rest_pat) => {
285285
self.check_pat_struct(pat, qpath, fields, has_rest_pat, expected, pat_info)
286286
}
287-
PatKind::Guard(pat, _) => {
287+
PatKind::Guard(pat, cond) => {
288288
self.check_pat(pat, expected, pat_info);
289+
self.check_expr_has_type_or_error(cond, self.tcx.types.bool, |_| {});
289290
expected
290291
}
291292
PatKind::Or(pats) => {

0 commit comments

Comments
 (0)