rust/tests/ui/rfcs/rfc-0000-never_patterns/check.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

34 lines
684 B
Rust
Raw Normal View History

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 => {}
}
}