Skip to content

Commit 58de9d9

Browse files
committed
Add some test cases
1 parent 65bc67e commit 58de9d9

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed

src/test/ui/pattern/usefulness/slice-patterns.rs

+14
Original file line numberDiff line numberDiff line change
@@ -93,4 +93,18 @@ fn main() {
9393
[false] => {}
9494
[..] => {}
9595
}
96+
match s {
97+
//~^ ERROR `&[_, _, true]` not covered
98+
[] => {}
99+
[_] => {}
100+
[_, _] => {}
101+
[.., false] => {}
102+
}
103+
match s {
104+
//~^ ERROR `&[true, _, _]` not covered
105+
[] => {}
106+
[_] => {}
107+
[_, _] => {}
108+
[false, .., false] => {}
109+
}
96110
}

src/test/ui/pattern/usefulness/slice-patterns.stderr

+17-1
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,22 @@ error: unreachable pattern
112112
LL | [false, true] => {}
113113
| ^^^^^^^^^^^^^
114114

115-
error: aborting due to 15 previous errors
115+
error[E0004]: non-exhaustive patterns: `&[_, _, true]` not covered
116+
--> $DIR/slice-patterns.rs:96:11
117+
|
118+
LL | match s {
119+
| ^ pattern `&[_, _, true]` not covered
120+
|
121+
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
122+
123+
error[E0004]: non-exhaustive patterns: `&[true, _, _]` not covered
124+
--> $DIR/slice-patterns.rs:103:11
125+
|
126+
LL | match s {
127+
| ^ pattern `&[true, _, _]` not covered
128+
|
129+
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
130+
131+
error: aborting due to 17 previous errors
116132

117133
For more information about this error, try `rustc --explain E0004`.

0 commit comments

Comments
 (0)