diff options
Diffstat (limited to 'src/test/ui/uninhabited/uninhabited-irrefutable.rs')
-rw-r--r-- | src/test/ui/uninhabited/uninhabited-irrefutable.rs | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/test/ui/uninhabited/uninhabited-irrefutable.rs b/src/test/ui/uninhabited/uninhabited-irrefutable.rs new file mode 100644 index 000000000..661b5486a --- /dev/null +++ b/src/test/ui/uninhabited/uninhabited-irrefutable.rs @@ -0,0 +1,28 @@ +#![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: `A(_)` not covered +} |