summaryrefslogtreecommitdiffstats
path: root/tests/ui/pattern/usefulness/nested-non-exhaustive-enums.rs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--tests/ui/pattern/usefulness/nested-non-exhaustive-enums.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/ui/pattern/usefulness/nested-non-exhaustive-enums.rs b/tests/ui/pattern/usefulness/nested-non-exhaustive-enums.rs
new file mode 100644
index 000000000..3a8a74d1f
--- /dev/null
+++ b/tests/ui/pattern/usefulness/nested-non-exhaustive-enums.rs
@@ -0,0 +1,18 @@
+// aux-build:non-exhaustive.rs
+
+extern crate non_exhaustive;
+
+use non_exhaustive::NonExhaustiveEnum;
+
+fn main() {
+ match Some(NonExhaustiveEnum::A) {
+ //~^ ERROR non-exhaustive patterns: `Some(_)` not covered [E0004]
+ //~| NOTE pattern `Some(_)` not covered
+ //~| NOTE `Option<NonExhaustiveEnum>` defined here
+ //~| NOTE the matched value is of type `Option<NonExhaustiveEnum>`
+ //~| NOTE `NonExhaustiveEnum` is marked as non-exhaustive
+ Some(NonExhaustiveEnum::A) => {}
+ Some(NonExhaustiveEnum::B) => {}
+ None => {}
+ }
+}