diff options
Diffstat (limited to 'tests/ui/pattern/usefulness/slice-patterns-reachability.rs')
-rw-r--r-- | tests/ui/pattern/usefulness/slice-patterns-reachability.rs | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/ui/pattern/usefulness/slice-patterns-reachability.rs b/tests/ui/pattern/usefulness/slice-patterns-reachability.rs new file mode 100644 index 000000000..7c747b5e0 --- /dev/null +++ b/tests/ui/pattern/usefulness/slice-patterns-reachability.rs @@ -0,0 +1,25 @@ +#![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] => {} + [..] => {} + } +} |