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