2023-11-26 18:08:39 -06:00
|
|
|
#![feature(never_patterns)]
|
|
|
|
#![allow(incomplete_features)]
|
|
|
|
|
|
|
|
enum Void {}
|
|
|
|
|
|
|
|
fn main() {}
|
|
|
|
|
|
|
|
macro_rules! never {
|
|
|
|
() => { ! }
|
|
|
|
}
|
|
|
|
|
|
|
|
fn no_arms_or_guards(x: Void) {
|
|
|
|
match None::<Void> {
|
|
|
|
Some(!) => {}
|
2023-11-26 21:08:09 -06:00
|
|
|
//~^ ERROR a never pattern is always unreachable
|
2023-11-26 18:08:39 -06:00
|
|
|
None => {}
|
|
|
|
}
|
|
|
|
match None::<Void> {
|
|
|
|
Some(!) if true,
|
2023-11-26 20:47:49 -06:00
|
|
|
//~^ ERROR guard on a never pattern
|
2023-11-26 18:08:39 -06:00
|
|
|
None => {}
|
|
|
|
}
|
|
|
|
match None::<Void> {
|
|
|
|
Some(!) if true => {}
|
2023-11-26 21:08:09 -06:00
|
|
|
//~^ ERROR a never pattern is always unreachable
|
2023-11-26 18:08:39 -06:00
|
|
|
None => {}
|
|
|
|
}
|
|
|
|
match None::<Void> {
|
|
|
|
Some(never!()) => {},
|
2023-11-26 21:08:09 -06:00
|
|
|
//~^ ERROR a never pattern is always unreachable
|
2023-11-26 18:08:39 -06:00
|
|
|
None => {}
|
|
|
|
}
|
|
|
|
}
|