diff options
| author | Max Niederman <max@maxniederman.com> | 2024-09-15 00:25:08 -0700 |
|---|---|---|
| committer | Max Niederman <max@maxniederman.com> | 2024-12-31 17:32:46 -0800 |
| commit | 087b8721dbaab3a607601e95a2c11779715c0603 (patch) | |
| tree | 5f20cf656a42ef8a561a7de624961605b6e8a3af | |
| parent | b579c36224d9143a5721e4427d95f60e82cce6a6 (diff) | |
| download | rust-087b8721dbaab3a607601e95a2c11779715c0603.tar.gz rust-087b8721dbaab3a607601e95a2c11779715c0603.zip | |
typecheck guard pattern conditions
| -rw-r--r-- | compiler/rustc_hir_typeck/src/pat.rs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/compiler/rustc_hir_typeck/src/pat.rs b/compiler/rustc_hir_typeck/src/pat.rs index 5c6fdc81a49..4870e6193c3 100644 --- a/compiler/rustc_hir_typeck/src/pat.rs +++ b/compiler/rustc_hir_typeck/src/pat.rs @@ -284,8 +284,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) => { |
