diff options
author | Dawer <[email protected]> | 2021-05-06 13:26:05 +0100 |
---|---|---|
committer | Dawer <[email protected]> | 2021-05-31 20:03:47 +0100 |
commit | d6d77e8a35cb2ac63b877f73bdf0ea6e6a1578e4 (patch) | |
tree | feea1e81b0dc0bdbb21466c04c373559b5508c78 /crates/hir_ty/src/diagnostics/pattern.rs | |
parent | e711abc29032ddd395b60fccc47063e49785168f (diff) |
Treat ctor of unhandled type as non-exhaustive.
Diffstat (limited to 'crates/hir_ty/src/diagnostics/pattern.rs')
-rw-r--r-- | crates/hir_ty/src/diagnostics/pattern.rs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/crates/hir_ty/src/diagnostics/pattern.rs b/crates/hir_ty/src/diagnostics/pattern.rs index 5c9419d2c..7b0b63d0b 100644 --- a/crates/hir_ty/src/diagnostics/pattern.rs +++ b/crates/hir_ty/src/diagnostics/pattern.rs | |||
@@ -356,4 +356,22 @@ fn main() { | |||
356 | "#, | 356 | "#, |
357 | ); | 357 | ); |
358 | } | 358 | } |
359 | |||
360 | #[test] | ||
361 | fn no_panic_at_unimplemented_subpattern_type() { | ||
362 | check_diagnostics( | ||
363 | r#" | ||
364 | struct S { a: char} | ||
365 | fn main(v: S) { | ||
366 | match v { S{ a } => {} } | ||
367 | match v { S{ a: x } => {} } | ||
368 | match v { S{ a: 'a' } => {} } | ||
369 | match v { S{..} => {} } | ||
370 | match v { _ => {} } | ||
371 | match v { } | ||
372 | //^ Missing match arm | ||
373 | } | ||
374 | "#, | ||
375 | ); | ||
376 | } | ||
359 | } | 377 | } |