Skip to content

Commit 33492c7

Browse files
committed
typecheck guard pattern conditions
1 parent fdba30b commit 33492c7

File tree

1 file changed

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

1 file changed

+2
-1
lines changed

compiler/rustc_hir_typeck/src/pat.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,8 +260,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
260260
PatKind::Struct(ref qpath, fields, has_rest_pat) => {
261261
self.check_pat_struct(pat, qpath, fields, has_rest_pat, expected, pat_info)
262262
}
263-
PatKind::Guard(pat, _) => {
263+
PatKind::Guard(pat, cond) => {
264264
self.check_pat(pat, expected, pat_info);
265+
self.check_expr_has_type_or_error(cond, self.tcx.types.bool, |_| {});
265266
expected
266267
}
267268
PatKind::Or(pats) => {

0 commit comments

Comments
 (0)