2016-11-30 21:37:03 -06:00
|
|
|
#![feature(box_patterns)]
|
2019-12-11 08:51:28 -06:00
|
|
|
#![feature(never_type)]
|
2018-01-21 02:44:41 -06:00
|
|
|
#![feature(exhaustive_patterns)]
|
2019-12-29 18:23:42 -06:00
|
|
|
|
2021-08-24 19:39:40 -05:00
|
|
|
|
2016-11-30 21:37:03 -06:00
|
|
|
#![deny(unreachable_patterns)]
|
|
|
|
|
|
|
|
mod foo {
|
|
|
|
pub struct SecretlyEmpty {
|
|
|
|
_priv: !,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
struct NotSoSecretlyEmpty {
|
|
|
|
_priv: !,
|
|
|
|
}
|
|
|
|
|
2017-02-04 02:27:45 -06:00
|
|
|
fn foo() -> Option<NotSoSecretlyEmpty> {
|
|
|
|
None
|
|
|
|
}
|
|
|
|
|
2016-11-30 21:37:03 -06:00
|
|
|
fn main() {
|
|
|
|
let x: &[!] = &[];
|
|
|
|
|
|
|
|
match x {
|
|
|
|
&[] => (),
|
|
|
|
&[..] => (), //~ ERROR unreachable pattern
|
|
|
|
};
|
|
|
|
|
|
|
|
let x: Result<Box<NotSoSecretlyEmpty>, &[Result<!, !>]> = Err(&[]);
|
|
|
|
match x {
|
|
|
|
Ok(box _) => (), //~ ERROR unreachable pattern
|
|
|
|
Err(&[]) => (),
|
|
|
|
Err(&[..]) => (), //~ ERROR unreachable pattern
|
|
|
|
}
|
|
|
|
|
|
|
|
let x: Result<foo::SecretlyEmpty, Result<NotSoSecretlyEmpty, u32>> = Err(Err(123));
|
|
|
|
match x {
|
|
|
|
Ok(_y) => (),
|
|
|
|
Err(Err(_y)) => (),
|
|
|
|
Err(Ok(_y)) => (), //~ ERROR unreachable pattern
|
|
|
|
}
|
2017-02-04 02:27:45 -06:00
|
|
|
|
|
|
|
while let Some(_y) = foo() {
|
|
|
|
//~^ ERROR unreachable pattern
|
|
|
|
}
|
2016-11-30 21:37:03 -06:00
|
|
|
}
|