rust/tests/ui/pattern/usefulness/slice-patterns-reachability.rs
2023-01-11 09:32:08 +00:00

26 lines
626 B
Rust

#![deny(unreachable_patterns)]
fn main() {
let s: &[bool] = &[];
match s {
[true, ..] => {}
[true, ..] => {} //~ ERROR unreachable pattern
[true] => {} //~ ERROR unreachable pattern
[..] => {}
}
match s {
[.., true] => {}
[.., true] => {} //~ ERROR unreachable pattern
[true] => {} //~ ERROR unreachable pattern
[..] => {}
}
match s {
[false, .., true] => {}
[false, .., true] => {} //~ ERROR unreachable pattern
[false, true] => {} //~ ERROR unreachable pattern
[false] => {}
[..] => {}
}
}