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.

23 lines
472 B
Rust
Raw Normal View History

2023-10-04 17:58:14 -05:00
#![feature(never_type)]
#![feature(exhaustive_patterns)]
#![deny(unreachable_patterns)]
fn main() {}
fn foo(nevers: &[!]) {
match nevers {
&[] => (),
};
match nevers {
&[] => (),
&[_] => (), //~ ERROR unreachable pattern
&[_, _, ..] => (), //~ ERROR unreachable pattern
};
match nevers {
//~^ ERROR non-exhaustive patterns: `&[]` not covered
&[_] => (), //~ ERROR unreachable pattern
};
}