2016-12-01 03:37:03 +00:00
|
|
|
#![feature(box_patterns)]
|
2019-12-11 14:51:28 +00:00
|
|
|
#![feature(never_type)]
|
2016-12-01 03:37:03 +00:00
|
|
|
#![deny(unreachable_patterns)]
|
|
|
|
|
|
|
|
mod foo {
|
|
|
|
pub struct SecretlyEmpty {
|
|
|
|
_priv: !,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
struct NotSoSecretlyEmpty {
|
|
|
|
_priv: !,
|
|
|
|
}
|
|
|
|
|
2017-02-04 08:27:45 +00:00
|
|
|
fn foo() -> Option<NotSoSecretlyEmpty> {
|
|
|
|
None
|
|
|
|
}
|
|
|
|
|
2016-12-01 03:37:03 +00:00
|
|
|
fn main() {
|
|
|
|
let x: &[!] = &[];
|
|
|
|
|
|
|
|
match x {
|
2023-10-29 09:13:07 +00:00
|
|
|
&[] => (),
|
2023-11-18 20:39:57 +00:00
|
|
|
&[..] => (),
|
2016-12-01 03:37:03 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
let x: Result<Box<NotSoSecretlyEmpty>, &[Result<!, !>]> = Err(&[]);
|
|
|
|
match x {
|
2023-10-29 09:13:07 +00:00
|
|
|
Ok(box _) => (), //~ ERROR unreachable pattern
|
2016-12-01 03:37:03 +00:00
|
|
|
Err(&[]) => (),
|
2023-11-18 20:39:57 +00:00
|
|
|
Err(&[..]) => (),
|
2016-12-01 03:37:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
let x: Result<foo::SecretlyEmpty, Result<NotSoSecretlyEmpty, u32>> = Err(Err(123));
|
|
|
|
match x {
|
|
|
|
Ok(_y) => (),
|
|
|
|
Err(Err(_y)) => (),
|
2023-10-29 09:13:07 +00:00
|
|
|
Err(Ok(_y)) => (), //~ ERROR unreachable pattern
|
2016-12-01 03:37:03 +00:00
|
|
|
}
|
2017-02-04 08:27:45 +00:00
|
|
|
|
|
|
|
while let Some(_y) = foo() {
|
|
|
|
//~^ ERROR unreachable pattern
|
|
|
|
}
|
2016-12-01 03:37:03 +00:00
|
|
|
}
|