aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_ty/src/diagnostics/pattern.rs
diff options
context:
space:
mode:
authorDawer <[email protected]>2021-04-22 16:17:27 +0100
committerDawer <[email protected]>2021-05-31 20:03:45 +0100
commitc3c2893f302d087ff3c1ddd3a1d4e88c03c4356b (patch)
treedc24743a4482f625b287c697f3ef17bfbfb9097f /crates/hir_ty/src/diagnostics/pattern.rs
parent7c1d8ca63510bb719fd91bbf38692e45b19c04d6 (diff)
Update match checking.
fn is_useful , more skeletons Specify a lifetime on pattern references impl PatStack fill impl Matrix PatStack::pop_head_constructor Index-based approach struct PatCtxt fields construction fn Fields::wildcards split wildcard fn Constructor::is_covered_by_any(..) fn Matrix::specialize_constructor(..) impl Usefulness Initial work on witness construction Reorganize files Replace match checking diagnostic Handle types of expanded patterns unit match checking go brrr
Diffstat (limited to 'crates/hir_ty/src/diagnostics/pattern.rs')
-rw-r--r--crates/hir_ty/src/diagnostics/pattern.rs36
1 files changed, 36 insertions, 0 deletions
diff --git a/crates/hir_ty/src/diagnostics/pattern.rs b/crates/hir_ty/src/diagnostics/pattern.rs
new file mode 100644
index 000000000..28c7a244d
--- /dev/null
+++ b/crates/hir_ty/src/diagnostics/pattern.rs
@@ -0,0 +1,36 @@
1#![deny(elided_lifetimes_in_paths)]
2#![allow(unused)] // todo remove
3
4mod deconstruct_pat;
5pub mod usefulness;
6
7#[cfg(test)]
8mod tests {
9 use crate::diagnostics::tests::check_diagnostics;
10
11 use super::*;
12
13 #[test]
14 fn unit_exhaustive() {
15 check_diagnostics(
16 r#"
17fn main() {
18 match () { () => {} }
19 match () { _ => {} }
20}
21"#,
22 );
23 }
24
25 #[test]
26 fn unit_non_exhaustive() {
27 check_diagnostics(
28 r#"
29fn main() {
30 match () { }
31 //^^ Missing match arm
32}
33"#,
34 );
35 }
36}