From d6d77e8a35cb2ac63b877f73bdf0ea6e6a1578e4 Mon Sep 17 00:00:00 2001 From: Dawer <7803845+iDawer@users.noreply.github.com> Date: Thu, 6 May 2021 17:26:05 +0500 Subject: Treat ctor of unhandled type as non-exhaustive. --- crates/hir_ty/src/diagnostics/pattern.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'crates/hir_ty/src/diagnostics/pattern.rs') 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 @@ -353,6 +353,24 @@ fn main() { //^^^^ Missing match arm } +"#, + ); + } + + #[test] + fn no_panic_at_unimplemented_subpattern_type() { + check_diagnostics( + r#" +struct S { a: char} +fn main(v: S) { + match v { S{ a } => {} } + match v { S{ a: x } => {} } + match v { S{ a: 'a' } => {} } + match v { S{..} => {} } + match v { _ => {} } + match v { } + //^ Missing match arm +} "#, ); } -- cgit v1.2.3