Skip to content

Commit 6d16655

Browse files
committed
Split-off the passing tests to ensure they pass
1 parent eeb12a4 commit 6d16655

File tree

2 files changed

+24
-17
lines changed

2 files changed

+24
-17
lines changed

Diff for: tests/ui/rfcs/rfc-0000-never_patterns/typeck.stderr renamed to tests/ui/rfcs/rfc-0000-never_patterns/typeck.fail.stderr

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,61 @@
11
error: mismatched types
2-
--> $DIR/typeck.rs:21:9
2+
--> $DIR/typeck.rs:25:9
33
|
44
LL | !,
55
| ^ a never pattern must be used on an uninhabited type
66
|
77
= note: the matched value is of type `()`
88

99
error: mismatched types
10-
--> $DIR/typeck.rs:25:9
10+
--> $DIR/typeck.rs:29:9
1111
|
1212
LL | !,
1313
| ^ a never pattern must be used on an uninhabited type
1414
|
1515
= note: the matched value is of type `(i32, bool)`
1616

1717
error: mismatched types
18-
--> $DIR/typeck.rs:29:13
18+
--> $DIR/typeck.rs:33:13
1919
|
2020
LL | (_, !),
2121
| ^ a never pattern must be used on an uninhabited type
2222
|
2323
= note: the matched value is of type `bool`
2424

2525
error: mismatched types
26-
--> $DIR/typeck.rs:34:14
26+
--> $DIR/typeck.rs:38:14
2727
|
2828
LL | Some(!),
2929
| ^ a never pattern must be used on an uninhabited type
3030
|
3131
= note: the matched value is of type `i32`
3232

3333
error: mismatched types
34-
--> $DIR/typeck.rs:41:9
34+
--> $DIR/typeck.rs:45:9
3535
|
3636
LL | !,
3737
| ^ a never pattern must be used on an uninhabited type
3838
|
3939
= note: the matched value is of type `()`
4040

4141
error: mismatched types
42-
--> $DIR/typeck.rs:48:9
42+
--> $DIR/typeck.rs:52:9
4343
|
4444
LL | !,
4545
| ^ a never pattern must be used on an uninhabited type
4646
|
4747
= note: the matched value is of type `Option<Void>`
4848

4949
error: mismatched types
50-
--> $DIR/typeck.rs:53:9
50+
--> $DIR/typeck.rs:57:9
5151
|
5252
LL | !,
5353
| ^ a never pattern must be used on an uninhabited type
5454
|
5555
= note: the matched value is of type `[Void]`
5656

5757
error: mismatched types
58-
--> $DIR/typeck.rs:59:9
58+
--> $DIR/typeck.rs:63:9
5959
|
6060
LL | !,
6161
| ^ a never pattern must be used on an uninhabited type

Diff for: tests/ui/rfcs/rfc-0000-never_patterns/typeck.rs

+16-9
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// revisions: pass fail
2+
//[pass] check-pass
3+
//[fail] check-fail
14
#![feature(never_patterns)]
25
#![feature(exhaustive_patterns)]
36
#![allow(incomplete_features)]
@@ -15,51 +18,55 @@ fn safe_unwrap_result<T: Copy>(res: Result<T, Void>) {
1518
}
1619

1720
// Check we only accept `!` where we want to.
18-
fn never_pattern_typeck(void: Void) {
21+
#[cfg(fail)]
22+
fn never_pattern_typeck_fail(void: Void) {
1923
// Don't accept on a non-empty type.
2024
match () {
2125
!,
22-
//~^ ERROR: mismatched types
26+
//[fail]~^ ERROR: mismatched types
2327
}
2428
match (0, false) {
2529
!,
26-
//~^ ERROR: mismatched types
30+
//[fail]~^ ERROR: mismatched types
2731
}
2832
match (0, false) {
2933
(_, !),
30-
//~^ ERROR: mismatched types
34+
//[fail]~^ ERROR: mismatched types
3135
}
3236
match Some(0) {
3337
None => {}
3438
Some(!),
35-
//~^ ERROR: mismatched types
39+
//[fail]~^ ERROR: mismatched types
3640
}
3741

3842
// Don't accept on an arbitrary type, even if there are no more branches.
3943
match () {
4044
() => {}
4145
!,
42-
//~^ ERROR: mismatched types
46+
//[fail]~^ ERROR: mismatched types
4347
}
4448

4549
// Don't accept even on an empty branch.
4650
match None::<Void> {
4751
None => {}
4852
!,
49-
//~^ ERROR: mismatched types
53+
//[fail]~^ ERROR: mismatched types
5054
}
5155
match (&[] as &[Void]) {
5256
[] => {}
5357
!,
54-
//~^ ERROR: mismatched types
58+
//[fail]~^ ERROR: mismatched types
5559
}
5660
// Let alone if the emptiness is behind a reference.
5761
match None::<&Void> {
5862
None => {}
5963
!,
60-
//~^ ERROR: mismatched types
64+
//[fail]~^ ERROR: mismatched types
6165
}
66+
}
6267

68+
#[cfg(pass)]
69+
fn never_pattern_typeck_pass(void: Void) {
6370
// Participate in match ergonomics.
6471
match &void {
6572
!,

0 commit comments

Comments
 (0)