]> git.lizzy.rs Git - rust.git/blobdiff - crates/hir_ty/src/infer/pat.rs
Implement const pat inference
[rust.git] / crates / hir_ty / src / infer / pat.rs
index b70ec55eb5c50bf9a0f9b41b35981112933a623e..d974f805b5ba82ac3a7f8ae45d63fea52713d956 100644 (file)
@@ -243,6 +243,9 @@ pub(super) fn infer_pat(
                 }
                 None => Ty::Unknown,
             },
+            Pat::ConstBlock(expr) => {
+                self.infer_expr(*expr, &Expectation::has_type(expected.clone()))
+            }
             Pat::Missing => Ty::Unknown,
         };
         // use a new type variable if we got Ty::Unknown here
@@ -264,8 +267,9 @@ fn is_non_ref_pat(body: &hir_def::body::Body, pat: PatId) -> bool {
         | Pat::Range { .. }
         | Pat::Slice { .. } => true,
         Pat::Or(pats) => pats.iter().all(|p| is_non_ref_pat(body, *p)),
-        // FIXME: Path/Lit might actually evaluate to ref, but inference is unimplemented.
+        // FIXME: ConstBlock/Path/Lit might actually evaluate to ref, but inference is unimplemented.
         Pat::Path(..) => true,
+        Pat::ConstBlock(..) => true,
         Pat::Lit(expr) => match body[*expr] {
             Expr::Literal(Literal::String(..)) => false,
             _ => true,