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

35 lines
807 B
Rust
Raw Normal View History

2024-02-08 00:09:31 +01:00
// Check that never patterns can't have bodies or guards.
2023-11-27 01:08:39 +01: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-27 04:08:09 +01:00
//~^ ERROR a never pattern is always unreachable
2023-11-27 01:08:39 +01:00
None => {}
}
match None::<Void> { //~ ERROR: `Some(!)` not covered
2023-11-27 01:08:39 +01:00
Some(!) if true,
2023-11-27 03:47:49 +01:00
//~^ ERROR guard on a never pattern
2023-11-27 01:08:39 +01:00
None => {}
}
match None::<Void> { //~ ERROR: `Some(!)` not covered
2023-11-27 01:08:39 +01:00
Some(!) if true => {}
2023-11-27 04:08:09 +01:00
//~^ ERROR a never pattern is always unreachable
2023-11-27 01:08:39 +01:00
None => {}
}
match None::<Void> {
Some(never!()) => {}
2023-11-27 04:08:09 +01:00
//~^ ERROR a never pattern is always unreachable
2023-11-27 01:08:39 +01:00
None => {}
}
}