Skip to content

Commit 2ecce0b

Browse files
committed
typecheck guard pattern conditions
1 parent ecbe6c0 commit 2ecce0b

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

+2-1
Original file line numberDiff line numberDiff line change
@@ -259,8 +259,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
259259
PatKind::Struct(ref qpath, fields, has_rest_pat) => {
260260
self.check_pat_struct(pat, qpath, fields, has_rest_pat, expected, pat_info)
261261
}
262-
PatKind::Guard(pat, _) => {
262+
PatKind::Guard(pat, cond) => {
263263
self.check_pat(pat, expected, pat_info);
264+
self.check_expr_has_type_or_error(cond, self.tcx.types.bool, |_| {});
264265
expected
265266
}
266267
PatKind::Or(pats) => {

0 commit comments

Comments
 (0)