File tree 2 files changed +31
-1
lines changed
src/test/ui/pattern/usefulness
2 files changed +31
-1
lines changed Original file line number Diff line number Diff line change @@ -93,4 +93,18 @@ fn main() {
93
93
[ false ] => { }
94
94
[ ..] => { }
95
95
}
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
+ }
96
110
}
Original file line number Diff line number Diff line change @@ -112,6 +112,22 @@ error: unreachable pattern
112
112
LL | [false, true] => {}
113
113
| ^^^^^^^^^^^^^
114
114
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
116
132
117
133
For more information about this error, try `rustc --explain E0004`.
You can’t perform that action at this time.
0 commit comments