Skip to content

Commit 5a4b25e

Browse files
committed
Update or-patterns tests
1 parent 52a4946 commit 5a4b25e

6 files changed

+24
-59
lines changed

src/test/ui/or-patterns/exhaustiveness-non-exhaustive.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,6 @@
55

66
// We wrap patterns in a tuple because top-level or-patterns are special-cased for now.
77
fn main() {
8-
// Get the fatal error out of the way
9-
match (0u8,) {
10-
(0 | _,) => {}
11-
//~^ ERROR or-patterns are not fully implemented yet
12-
}
13-
148
match (0u8, 0u8) {
159
//~^ ERROR non-exhaustive patterns: `(2u8..=std::u8::MAX, _)`
1610
(0 | 1, 2 | 3) => {}
Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,27 @@
11
error[E0004]: non-exhaustive patterns: `(2u8..=std::u8::MAX, _)` not covered
2-
--> $DIR/exhaustiveness-non-exhaustive.rs:14:11
2+
--> $DIR/exhaustiveness-non-exhaustive.rs:8:11
33
|
44
LL | match (0u8, 0u8) {
55
| ^^^^^^^^^^ pattern `(2u8..=std::u8::MAX, _)` not covered
66
|
77
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
88

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

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

25-
error: or-patterns are not fully implemented yet
26-
--> $DIR/exhaustiveness-non-exhaustive.rs:10:10
27-
|
28-
LL | (0 | _,) => {}
29-
| ^^^^^
30-
31-
error: aborting due to 4 previous errors
25+
error: aborting due to 3 previous errors
3226

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

src/test/ui/or-patterns/exhaustiveness-pass.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
1+
// check-pass
2+
13
#![feature(or_patterns)]
24
#![feature(slice_patterns)]
35
#![allow(incomplete_features)]
46
#![deny(unreachable_patterns)]
57

68
// We wrap patterns in a tuple because top-level or-patterns are special-cased for now.
79
fn main() {
8-
// Get the fatal error out of the way
9-
match (0,) {
10-
(0 | _,) => {}
11-
//~^ ERROR or-patterns are not fully implemented yet
12-
}
13-
1410
match (0,) {
1511
(1 | 2,) => {}
1612
_ => {}
@@ -38,6 +34,7 @@ fn main() {
3834
((0, 0) | (0, 1),) => {}
3935
_ => {}
4036
}
37+
4138
match ((0, 0),) {
4239
((0, 0) | (1, 0),) => {}
4340
_ => {}

src/test/ui/or-patterns/exhaustiveness-pass.stderr

Lines changed: 0 additions & 8 deletions
This file was deleted.

src/test/ui/or-patterns/exhaustiveness-unreachable-pattern.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,6 @@
55

66
// We wrap patterns in a tuple because top-level or-patterns are special-cased for now.
77
fn main() {
8-
// Get the fatal error out of the way
9-
match (0u8,) {
10-
(0 | _,) => {}
11-
//~^ ERROR or-patterns are not fully implemented yet
12-
}
13-
148
match (0u8,) {
159
(1 | 2,) => {}
1610
(1,) => {} //~ ERROR unreachable pattern
Lines changed: 17 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: unreachable pattern
2-
--> $DIR/exhaustiveness-unreachable-pattern.rs:16:9
2+
--> $DIR/exhaustiveness-unreachable-pattern.rs:10:9
33
|
44
LL | (1,) => {}
55
| ^^^^
@@ -11,100 +11,94 @@ LL | #![deny(unreachable_patterns)]
1111
| ^^^^^^^^^^^^^^^^^^^^
1212

1313
error: unreachable pattern
14-
--> $DIR/exhaustiveness-unreachable-pattern.rs:21:9
14+
--> $DIR/exhaustiveness-unreachable-pattern.rs:15:9
1515
|
1616
LL | (2,) => {}
1717
| ^^^^
1818

1919
error: unreachable pattern
20-
--> $DIR/exhaustiveness-unreachable-pattern.rs:27:9
20+
--> $DIR/exhaustiveness-unreachable-pattern.rs:21:9
2121
|
2222
LL | (1 | 2,) => {}
2323
| ^^^^^^^^
2424

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

3131
error: unreachable pattern
32-
--> $DIR/exhaustiveness-unreachable-pattern.rs:33:9
32+
--> $DIR/exhaustiveness-unreachable-pattern.rs:27:9
3333
|
3434
LL | (1, 4) => {}
3535
| ^^^^^^
3636

3737
error: unreachable pattern
38-
--> $DIR/exhaustiveness-unreachable-pattern.rs:34:9
38+
--> $DIR/exhaustiveness-unreachable-pattern.rs:28:9
3939
|
4040
LL | (2, 4) => {}
4141
| ^^^^^^
4242

4343
error: unreachable pattern
44-
--> $DIR/exhaustiveness-unreachable-pattern.rs:35:9
44+
--> $DIR/exhaustiveness-unreachable-pattern.rs:29:9
4545
|
4646
LL | (2 | 1, 4) => {}
4747
| ^^^^^^^^^^
4848

4949
error: unreachable pattern
50-
--> $DIR/exhaustiveness-unreachable-pattern.rs:37:9
50+
--> $DIR/exhaustiveness-unreachable-pattern.rs:31:9
5151
|
5252
LL | (1, 4 | 5) => {}
5353
| ^^^^^^^^^^
5454

5555
error: unreachable pattern
56-
--> $DIR/exhaustiveness-unreachable-pattern.rs:42:9
56+
--> $DIR/exhaustiveness-unreachable-pattern.rs:36:9
5757
|
5858
LL | (Some(1),) => {}
5959
| ^^^^^^^^^^
6060

6161
error: unreachable pattern
62-
--> $DIR/exhaustiveness-unreachable-pattern.rs:43:9
62+
--> $DIR/exhaustiveness-unreachable-pattern.rs:37:9
6363
|
6464
LL | (None,) => {}
6565
| ^^^^^^^
6666

6767
error: unreachable pattern
68-
--> $DIR/exhaustiveness-unreachable-pattern.rs:48:9
68+
--> $DIR/exhaustiveness-unreachable-pattern.rs:42:9
6969
|
7070
LL | ((1..=4,),) => {},
7171
| ^^^^^^^^^^^
7272

7373
error: unreachable pattern
74-
--> $DIR/exhaustiveness-unreachable-pattern.rs:54:12
74+
--> $DIR/exhaustiveness-unreachable-pattern.rs:48:12
7575
|
7676
LL | | 1,) => {}
7777
| ^
7878

7979
error: unreachable pattern
80-
--> $DIR/exhaustiveness-unreachable-pattern.rs:61:15
80+
--> $DIR/exhaustiveness-unreachable-pattern.rs:55:15
8181
|
8282
LL | | 0] => {}
8383
| ^
8484

8585
error: unreachable pattern
86-
--> $DIR/exhaustiveness-unreachable-pattern.rs:59:15
86+
--> $DIR/exhaustiveness-unreachable-pattern.rs:53:15
8787
|
8888
LL | | 0
8989
| ^
9090

9191
error: unreachable pattern
92-
--> $DIR/exhaustiveness-unreachable-pattern.rs:69:10
92+
--> $DIR/exhaustiveness-unreachable-pattern.rs:63:10
9393
|
9494
LL | [1
9595
| ^
9696

9797
error: unreachable pattern
98-
--> $DIR/exhaustiveness-unreachable-pattern.rs:75:14
98+
--> $DIR/exhaustiveness-unreachable-pattern.rs:69:14
9999
|
100100
LL | Some(0
101101
| ^
102102

103-
error: or-patterns are not fully implemented yet
104-
--> $DIR/exhaustiveness-unreachable-pattern.rs:10:10
105-
|
106-
LL | (0 | _,) => {}
107-
| ^^^^^
108-
109-
error: aborting due to 17 previous errors
103+
error: aborting due to 16 previous errors
110104

0 commit comments

Comments
 (0)