about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJason Newcomb <jsnewcomb@pm.me>2021-03-08 10:33:36 -0500
committerJason Newcomb <jsnewcomb@pm.me>2021-03-17 12:04:19 -0400
commit6cc9cac4bc7a2eca8528bfa78383dac68cc5b7bf (patch)
tree1aee816b5ceb48fa58ce40f5f333da5b38f033ee
parent0b7ab90ecae3c5ab55aa053ea9477cab88ab7f0e (diff)
downloadrust-6cc9cac4bc7a2eca8528bfa78383dac68cc5b7bf.tar.gz
rust-6cc9cac4bc7a2eca8528bfa78383dac68cc5b7bf.zip
Add test for `#[non_exhaustive]` enum in `match_wildcard_for_single-variant`
-rw-r--r--tests/ui/match_wildcard_for_single_variants.fixed12
-rw-r--r--tests/ui/match_wildcard_for_single_variants.rs12
2 files changed, 24 insertions, 0 deletions
diff --git a/tests/ui/match_wildcard_for_single_variants.fixed b/tests/ui/match_wildcard_for_single_variants.fixed
index f101e144a13..d99f9af3faf 100644
--- a/tests/ui/match_wildcard_for_single_variants.fixed
+++ b/tests/ui/match_wildcard_for_single_variants.fixed
@@ -96,4 +96,16 @@ fn main() {
         Some(_) => 1,
         _ => 2,
     };
+
+    #[non_exhaustive]
+    enum Bar {
+        A,
+        B,
+        C,
+    }
+    match Bar::A {
+        Bar::A => (),
+        Bar::B => (),
+        _ => (),
+    };
 }
diff --git a/tests/ui/match_wildcard_for_single_variants.rs b/tests/ui/match_wildcard_for_single_variants.rs
index 1ddba87e78f..1752a95de4b 100644
--- a/tests/ui/match_wildcard_for_single_variants.rs
+++ b/tests/ui/match_wildcard_for_single_variants.rs
@@ -96,4 +96,16 @@ fn main() {
         Some(_) => 1,
         _ => 2,
     };
+
+    #[non_exhaustive]
+    enum Bar {
+        A,
+        B,
+        C,
+    }
+    match Bar::A {
+        Bar::A => (),
+        Bar::B => (),
+        _ => (),
+    };
 }