rust/tests/ui/pattern/usefulness/slice_of_empty.rs

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

26 lines
633 B
Rust
Raw Normal View History

2024-07-27 09:08:16 +00:00
//@ revisions: normal exhaustive_patterns
#![cfg_attr(exhaustive_patterns, feature(exhaustive_patterns))]
2023-10-04 22:58:14 +00:00
#![feature(never_type)]
#![deny(unreachable_patterns)]
fn main() {}
fn foo(nevers: &[!]) {
match nevers {
2024-07-27 09:08:16 +00:00
//[normal]~^ ERROR non-exhaustive patterns: `&[_, ..]` not covered
2023-10-04 22:58:14 +00:00
&[] => (),
};
match nevers {
&[] => (),
&[_] => (),
&[_, _, ..] => (),
2023-10-04 22:58:14 +00:00
};
match nevers {
//[exhaustive_patterns]~^ ERROR non-exhaustive patterns: `&[]` not covered
2024-07-27 09:08:16 +00:00
//[normal]~^^ ERROR non-exhaustive patterns: `&[]` and `&[_, _, ..]` not covered
&[_] => (),
2023-10-04 22:58:14 +00:00
};
}