summaryrefslogtreecommitdiffstats
path: root/tests/ui/uninhabited/uninhabited-irrefutable.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/uninhabited/uninhabited-irrefutable.rs')
-rw-r--r--tests/ui/uninhabited/uninhabited-irrefutable.rs30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/ui/uninhabited/uninhabited-irrefutable.rs b/tests/ui/uninhabited/uninhabited-irrefutable.rs
new file mode 100644
index 000000000..4b001aca2
--- /dev/null
+++ b/tests/ui/uninhabited/uninhabited-irrefutable.rs
@@ -0,0 +1,30 @@
+#![feature(never_type)]
+#![feature(exhaustive_patterns)]
+
+mod foo {
+ pub struct SecretlyEmpty {
+ _priv: !,
+ }
+
+ pub struct NotSoSecretlyEmpty {
+ pub _pub: !,
+ }
+}
+
+struct NotSoSecretlyEmpty {
+ _priv: !,
+}
+
+enum Foo {
+ A(foo::SecretlyEmpty),
+ B(foo::NotSoSecretlyEmpty),
+ C(NotSoSecretlyEmpty),
+ D(u32, u32),
+}
+
+fn main() {
+ let x: Foo = Foo::D(123, 456);
+ let Foo::D(_y, _z) = x;
+ //~^ ERROR refutable pattern in local binding
+ //~| `Foo::A(_)` not covered
+}