Add some tests
This commit is contained in:
parent
143fb4357f
commit
c00ecfa8d2
2 changed files with 49 additions and 23 deletions
|
@ -5,6 +5,20 @@ fn main() {
|
||||||
let s1: &[bool; 1] = &[false; 1];
|
let s1: &[bool; 1] = &[false; 1];
|
||||||
let s2: &[bool; 2] = &[false; 2];
|
let s2: &[bool; 2] = &[false; 2];
|
||||||
let s3: &[bool; 3] = &[false; 3];
|
let s3: &[bool; 3] = &[false; 3];
|
||||||
|
let s10: &[bool; 10] = &[false; 10];
|
||||||
|
|
||||||
|
match s2 {
|
||||||
|
//~^ ERROR `&[false, _]` not covered
|
||||||
|
[true, .., true] => {}
|
||||||
|
}
|
||||||
|
match s3 {
|
||||||
|
//~^ ERROR `&[false, _, _]` not covered
|
||||||
|
[true, .., true] => {}
|
||||||
|
}
|
||||||
|
match s10 {
|
||||||
|
//~^ ERROR `&[false, _, _, _, _, _, _, _, _, _]` not covered
|
||||||
|
[true, .., true] => {}
|
||||||
|
}
|
||||||
|
|
||||||
match s1 {
|
match s1 {
|
||||||
[true, ..] => {}
|
[true, ..] => {}
|
||||||
|
@ -27,10 +41,6 @@ fn main() {
|
||||||
[.., false] => {}
|
[.., false] => {}
|
||||||
}
|
}
|
||||||
|
|
||||||
match s3 {
|
|
||||||
//~^ ERROR `&[false, _, _]` not covered
|
|
||||||
[true, .., true] => {}
|
|
||||||
}
|
|
||||||
match s {
|
match s {
|
||||||
//~^ ERROR `&[_, ..]` not covered
|
//~^ ERROR `&[_, ..]` not covered
|
||||||
[] => {}
|
[] => {}
|
||||||
|
|
|
@ -1,5 +1,29 @@
|
||||||
|
error[E0004]: non-exhaustive patterns: `&[false, _]` not covered
|
||||||
|
--> $DIR/slice-patterns-exhaustiveness.rs:10:11
|
||||||
|
|
|
||||||
|
LL | match s2 {
|
||||||
|
| ^^ pattern `&[false, _]` not covered
|
||||||
|
|
|
||||||
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
|
||||||
|
|
||||||
|
error[E0004]: non-exhaustive patterns: `&[false, _, _]` not covered
|
||||||
|
--> $DIR/slice-patterns-exhaustiveness.rs:14:11
|
||||||
|
|
|
||||||
|
LL | match s3 {
|
||||||
|
| ^^ pattern `&[false, _, _]` not covered
|
||||||
|
|
|
||||||
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
|
||||||
|
|
||||||
|
error[E0004]: non-exhaustive patterns: `&[false, _, _, _, _, _, _, _, _, _]` not covered
|
||||||
|
--> $DIR/slice-patterns-exhaustiveness.rs:18:11
|
||||||
|
|
|
||||||
|
LL | match s10 {
|
||||||
|
| ^^^ pattern `&[false, _, _, _, _, _, _, _, _, _]` not covered
|
||||||
|
|
|
||||||
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
|
||||||
|
|
||||||
error[E0004]: non-exhaustive patterns: `&[false, true]` not covered
|
error[E0004]: non-exhaustive patterns: `&[false, true]` not covered
|
||||||
--> $DIR/slice-patterns-exhaustiveness.rs:13:11
|
--> $DIR/slice-patterns-exhaustiveness.rs:27:11
|
||||||
|
|
|
|
||||||
LL | match s2 {
|
LL | match s2 {
|
||||||
| ^^ pattern `&[false, true]` not covered
|
| ^^ pattern `&[false, true]` not covered
|
||||||
|
@ -7,7 +31,7 @@ LL | match s2 {
|
||||||
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
|
||||||
|
|
||||||
error[E0004]: non-exhaustive patterns: `&[false, _, true]` not covered
|
error[E0004]: non-exhaustive patterns: `&[false, _, true]` not covered
|
||||||
--> $DIR/slice-patterns-exhaustiveness.rs:18:11
|
--> $DIR/slice-patterns-exhaustiveness.rs:32:11
|
||||||
|
|
|
|
||||||
LL | match s3 {
|
LL | match s3 {
|
||||||
| ^^ pattern `&[false, _, true]` not covered
|
| ^^ pattern `&[false, _, true]` not covered
|
||||||
|
@ -15,23 +39,15 @@ LL | match s3 {
|
||||||
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
|
||||||
|
|
||||||
error[E0004]: non-exhaustive patterns: `&[false, .., true]` not covered
|
error[E0004]: non-exhaustive patterns: `&[false, .., true]` not covered
|
||||||
--> $DIR/slice-patterns-exhaustiveness.rs:23:11
|
--> $DIR/slice-patterns-exhaustiveness.rs:37:11
|
||||||
|
|
|
|
||||||
LL | match s {
|
LL | match s {
|
||||||
| ^ pattern `&[false, .., true]` not covered
|
| ^ pattern `&[false, .., true]` not covered
|
||||||
|
|
|
|
||||||
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
|
||||||
|
|
||||||
error[E0004]: non-exhaustive patterns: `&[false, _, _]` not covered
|
|
||||||
--> $DIR/slice-patterns-exhaustiveness.rs:30:11
|
|
||||||
|
|
|
||||||
LL | match s3 {
|
|
||||||
| ^^ pattern `&[false, _, _]` not covered
|
|
||||||
|
|
|
||||||
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
|
|
||||||
|
|
||||||
error[E0004]: non-exhaustive patterns: `&[_, ..]` not covered
|
error[E0004]: non-exhaustive patterns: `&[_, ..]` not covered
|
||||||
--> $DIR/slice-patterns-exhaustiveness.rs:34:11
|
--> $DIR/slice-patterns-exhaustiveness.rs:44:11
|
||||||
|
|
|
|
||||||
LL | match s {
|
LL | match s {
|
||||||
| ^ pattern `&[_, ..]` not covered
|
| ^ pattern `&[_, ..]` not covered
|
||||||
|
@ -39,7 +55,7 @@ LL | match s {
|
||||||
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
|
||||||
|
|
||||||
error[E0004]: non-exhaustive patterns: `&[_, _, ..]` not covered
|
error[E0004]: non-exhaustive patterns: `&[_, _, ..]` not covered
|
||||||
--> $DIR/slice-patterns-exhaustiveness.rs:38:11
|
--> $DIR/slice-patterns-exhaustiveness.rs:48:11
|
||||||
|
|
|
|
||||||
LL | match s {
|
LL | match s {
|
||||||
| ^ pattern `&[_, _, ..]` not covered
|
| ^ pattern `&[_, _, ..]` not covered
|
||||||
|
@ -47,7 +63,7 @@ LL | match s {
|
||||||
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
|
||||||
|
|
||||||
error[E0004]: non-exhaustive patterns: `&[false, ..]` not covered
|
error[E0004]: non-exhaustive patterns: `&[false, ..]` not covered
|
||||||
--> $DIR/slice-patterns-exhaustiveness.rs:43:11
|
--> $DIR/slice-patterns-exhaustiveness.rs:53:11
|
||||||
|
|
|
|
||||||
LL | match s {
|
LL | match s {
|
||||||
| ^ pattern `&[false, ..]` not covered
|
| ^ pattern `&[false, ..]` not covered
|
||||||
|
@ -55,7 +71,7 @@ LL | match s {
|
||||||
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
|
||||||
|
|
||||||
error[E0004]: non-exhaustive patterns: `&[false, _, ..]` not covered
|
error[E0004]: non-exhaustive patterns: `&[false, _, ..]` not covered
|
||||||
--> $DIR/slice-patterns-exhaustiveness.rs:48:11
|
--> $DIR/slice-patterns-exhaustiveness.rs:58:11
|
||||||
|
|
|
|
||||||
LL | match s {
|
LL | match s {
|
||||||
| ^ pattern `&[false, _, ..]` not covered
|
| ^ pattern `&[false, _, ..]` not covered
|
||||||
|
@ -63,7 +79,7 @@ LL | match s {
|
||||||
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
|
||||||
|
|
||||||
error[E0004]: non-exhaustive patterns: `&[_, .., false]` not covered
|
error[E0004]: non-exhaustive patterns: `&[_, .., false]` not covered
|
||||||
--> $DIR/slice-patterns-exhaustiveness.rs:54:11
|
--> $DIR/slice-patterns-exhaustiveness.rs:64:11
|
||||||
|
|
|
|
||||||
LL | match s {
|
LL | match s {
|
||||||
| ^ pattern `&[_, .., false]` not covered
|
| ^ pattern `&[_, .., false]` not covered
|
||||||
|
@ -71,7 +87,7 @@ LL | match s {
|
||||||
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
|
||||||
|
|
||||||
error[E0004]: non-exhaustive patterns: `&[_, _, .., true]` not covered
|
error[E0004]: non-exhaustive patterns: `&[_, _, .., true]` not covered
|
||||||
--> $DIR/slice-patterns-exhaustiveness.rs:61:11
|
--> $DIR/slice-patterns-exhaustiveness.rs:71:11
|
||||||
|
|
|
|
||||||
LL | match s {
|
LL | match s {
|
||||||
| ^ pattern `&[_, _, .., true]` not covered
|
| ^ pattern `&[_, _, .., true]` not covered
|
||||||
|
@ -79,13 +95,13 @@ LL | match s {
|
||||||
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
|
||||||
|
|
||||||
error[E0004]: non-exhaustive patterns: `&[true, _, .., _]` not covered
|
error[E0004]: non-exhaustive patterns: `&[true, _, .., _]` not covered
|
||||||
--> $DIR/slice-patterns-exhaustiveness.rs:68:11
|
--> $DIR/slice-patterns-exhaustiveness.rs:78:11
|
||||||
|
|
|
|
||||||
LL | match s {
|
LL | match s {
|
||||||
| ^ pattern `&[true, _, .., _]` not covered
|
| ^ pattern `&[true, _, .., _]` not covered
|
||||||
|
|
|
|
||||||
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
|
||||||
|
|
||||||
error: aborting due to 11 previous errors
|
error: aborting due to 13 previous errors
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0004`.
|
For more information about this error, try `rustc --explain E0004`.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue