Skip to content

Commit

Permalink
Update or-patterns tests
Browse files Browse the repository at this point in the history
  • Loading branch information
varkor committed Dec 23, 2019
1 parent 52a4946 commit 5a4b25e
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 59 deletions.
6 changes: 0 additions & 6 deletions src/test/ui/or-patterns/exhaustiveness-non-exhaustive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,6 @@

// We wrap patterns in a tuple because top-level or-patterns are special-cased for now.
fn main() {
// Get the fatal error out of the way
match (0u8,) {
(0 | _,) => {}
//~^ ERROR or-patterns are not fully implemented yet
}

match (0u8, 0u8) {
//~^ ERROR non-exhaustive patterns: `(2u8..=std::u8::MAX, _)`
(0 | 1, 2 | 3) => {}
Expand Down
14 changes: 4 additions & 10 deletions src/test/ui/or-patterns/exhaustiveness-non-exhaustive.stderr
Original file line number Diff line number Diff line change
@@ -1,33 +1,27 @@
error[E0004]: non-exhaustive patterns: `(2u8..=std::u8::MAX, _)` not covered
--> $DIR/exhaustiveness-non-exhaustive.rs:14:11
--> $DIR/exhaustiveness-non-exhaustive.rs:8:11
|
LL | match (0u8, 0u8) {
| ^^^^^^^^^^ pattern `(2u8..=std::u8::MAX, _)` not covered
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms

error[E0004]: non-exhaustive patterns: `((4u8..=std::u8::MAX))` not covered
--> $DIR/exhaustiveness-non-exhaustive.rs:18:11
--> $DIR/exhaustiveness-non-exhaustive.rs:12:11
|
LL | match ((0u8,),) {
| ^^^^^^^^^ pattern `((4u8..=std::u8::MAX))` not covered
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms

error[E0004]: non-exhaustive patterns: `(Some(2u8..=std::u8::MAX))` not covered
--> $DIR/exhaustiveness-non-exhaustive.rs:22:11
--> $DIR/exhaustiveness-non-exhaustive.rs:16:11
|
LL | match (Some(0u8),) {
| ^^^^^^^^^^^^ pattern `(Some(2u8..=std::u8::MAX))` not covered
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms

error: or-patterns are not fully implemented yet
--> $DIR/exhaustiveness-non-exhaustive.rs:10:10
|
LL | (0 | _,) => {}
| ^^^^^

error: aborting due to 4 previous errors
error: aborting due to 3 previous errors

For more information about this error, try `rustc --explain E0004`.
9 changes: 3 additions & 6 deletions src/test/ui/or-patterns/exhaustiveness-pass.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
// check-pass

#![feature(or_patterns)]
#![feature(slice_patterns)]
#![allow(incomplete_features)]
#![deny(unreachable_patterns)]

// We wrap patterns in a tuple because top-level or-patterns are special-cased for now.
fn main() {
// Get the fatal error out of the way
match (0,) {
(0 | _,) => {}
//~^ ERROR or-patterns are not fully implemented yet
}

match (0,) {
(1 | 2,) => {}
_ => {}
Expand Down Expand Up @@ -38,6 +34,7 @@ fn main() {
((0, 0) | (0, 1),) => {}
_ => {}
}

match ((0, 0),) {
((0, 0) | (1, 0),) => {}
_ => {}
Expand Down
8 changes: 0 additions & 8 deletions src/test/ui/or-patterns/exhaustiveness-pass.stderr

This file was deleted.

6 changes: 0 additions & 6 deletions src/test/ui/or-patterns/exhaustiveness-unreachable-pattern.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,6 @@

// We wrap patterns in a tuple because top-level or-patterns are special-cased for now.
fn main() {
// Get the fatal error out of the way
match (0u8,) {
(0 | _,) => {}
//~^ ERROR or-patterns are not fully implemented yet
}

match (0u8,) {
(1 | 2,) => {}
(1,) => {} //~ ERROR unreachable pattern
Expand Down
40 changes: 17 additions & 23 deletions src/test/ui/or-patterns/exhaustiveness-unreachable-pattern.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:16:9
--> $DIR/exhaustiveness-unreachable-pattern.rs:10:9
|
LL | (1,) => {}
| ^^^^
Expand All @@ -11,100 +11,94 @@ LL | #![deny(unreachable_patterns)]
| ^^^^^^^^^^^^^^^^^^^^

error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:21:9
--> $DIR/exhaustiveness-unreachable-pattern.rs:15:9
|
LL | (2,) => {}
| ^^^^

error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:27:9
--> $DIR/exhaustiveness-unreachable-pattern.rs:21:9
|
LL | (1 | 2,) => {}
| ^^^^^^^^

error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:32:9
--> $DIR/exhaustiveness-unreachable-pattern.rs:26:9
|
LL | (1, 3) => {}
| ^^^^^^

error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:33:9
--> $DIR/exhaustiveness-unreachable-pattern.rs:27:9
|
LL | (1, 4) => {}
| ^^^^^^

error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:34:9
--> $DIR/exhaustiveness-unreachable-pattern.rs:28:9
|
LL | (2, 4) => {}
| ^^^^^^

error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:35:9
--> $DIR/exhaustiveness-unreachable-pattern.rs:29:9
|
LL | (2 | 1, 4) => {}
| ^^^^^^^^^^

error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:37:9
--> $DIR/exhaustiveness-unreachable-pattern.rs:31:9
|
LL | (1, 4 | 5) => {}
| ^^^^^^^^^^

error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:42:9
--> $DIR/exhaustiveness-unreachable-pattern.rs:36:9
|
LL | (Some(1),) => {}
| ^^^^^^^^^^

error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:43:9
--> $DIR/exhaustiveness-unreachable-pattern.rs:37:9
|
LL | (None,) => {}
| ^^^^^^^

error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:48:9
--> $DIR/exhaustiveness-unreachable-pattern.rs:42:9
|
LL | ((1..=4,),) => {},
| ^^^^^^^^^^^

error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:54:12
--> $DIR/exhaustiveness-unreachable-pattern.rs:48:12
|
LL | | 1,) => {}
| ^

error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:61:15
--> $DIR/exhaustiveness-unreachable-pattern.rs:55:15
|
LL | | 0] => {}
| ^

error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:59:15
--> $DIR/exhaustiveness-unreachable-pattern.rs:53:15
|
LL | | 0
| ^

error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:69:10
--> $DIR/exhaustiveness-unreachable-pattern.rs:63:10
|
LL | [1
| ^

error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:75:14
--> $DIR/exhaustiveness-unreachable-pattern.rs:69:14
|
LL | Some(0
| ^

error: or-patterns are not fully implemented yet
--> $DIR/exhaustiveness-unreachable-pattern.rs:10:10
|
LL | (0 | _,) => {}
| ^^^^^

error: aborting due to 17 previous errors
error: aborting due to 16 previous errors

0 comments on commit 5a4b25e

Please sign in to comment.