Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-ty/src/lib.rs')
-rw-r--r--crates/hir-ty/src/lib.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/crates/hir-ty/src/lib.rs b/crates/hir-ty/src/lib.rs
index 4b159b7541..55d81875a2 100644
--- a/crates/hir-ty/src/lib.rs
+++ b/crates/hir-ty/src/lib.rs
@@ -1049,3 +1049,20 @@ pub fn known_const_to_ast(
}
Some(make::expr_const_value(konst.display(db, edition).to_string().as_str()))
}
+
+#[derive(Debug, Copy, Clone)]
+pub(crate) enum DeclOrigin {
+ LetExpr,
+ /// from `let x = ..`
+ LocalDecl {
+ has_else: bool,
+ },
+}
+
+/// Provides context for checking patterns in declarations. More specifically this
+/// allows us to infer array types if the pattern is irrefutable and allows us to infer
+/// the size of the array. See issue rust-lang/rust#76342.
+#[derive(Debug, Copy, Clone)]
+pub(crate) struct DeclContext {
+ pub(crate) origin: DeclOrigin,
+}