Introduce new FixedLenSlice constructor

It is used in the case where a variable-length slice pattern is used to
match on an array of known size. This allows considering only those
entries in the array that are captured by one of the patterns.
As a side-effect, diagnostics improve a bit for those cases.
This commit is contained in:
Nadrieril
2019-11-16 16:05:32 +00:00
parent c00ecfa8d2
commit d93c1b320c
4 changed files with 92 additions and 37 deletions

View File

@@ -1,8 +1,8 @@
error[E0004]: non-exhaustive patterns: `&[_, _, _, _]` not covered
error[E0004]: non-exhaustive patterns: `&[..]` not covered
--> $DIR/match-byte-array-patterns-2.rs:4:11
|
LL | match buf {
| ^^^ pattern `&[_, _, _, _]` not covered
| ^^^ pattern `&[..]` not covered
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms