Skip to content

Commit 8774207

Browse files
committed
And --bless tests accordingly for those exceptions.
1 parent 18ccd6a commit 8774207

14 files changed

+198
-534
lines changed

src/test/ui/associated-path-shl.rs

-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,5 @@ fn main() {
55
let _ = <<A>::B>::C; //~ ERROR cannot find type `A` in this scope
66
let <<A>::B>::C; //~ ERROR cannot find type `A` in this scope
77
let 0 ..= <<A>::B>::C; //~ ERROR cannot find type `A` in this scope
8-
//~^ ERROR only char and numeric types are allowed in range patterns
98
<<A>::B>::C; //~ ERROR cannot find type `A` in this scope
109
}

src/test/ui/associated-path-shl.stderr

+3-13
Original file line numberDiff line numberDiff line change
@@ -23,21 +23,11 @@ LL | let 0 ..= <<A>::B>::C;
2323
| ^ not found in this scope
2424

2525
error[E0412]: cannot find type `A` in this scope
26-
--> $DIR/associated-path-shl.rs:9:7
26+
--> $DIR/associated-path-shl.rs:8:7
2727
|
2828
LL | <<A>::B>::C;
2929
| ^ not found in this scope
3030

31-
error[E0029]: only char and numeric types are allowed in range patterns
32-
--> $DIR/associated-path-shl.rs:7:15
33-
|
34-
LL | let 0 ..= <<A>::B>::C;
35-
| ^^^^^^^^^^^ ranges require char or numeric types
36-
|
37-
= note: start type: {integer}
38-
= note: end type: [type error]
39-
40-
error: aborting due to 6 previous errors
31+
error: aborting due to 5 previous errors
4132

42-
Some errors have detailed explanations: E0029, E0412.
43-
For more information about an error, try `rustc --explain E0029`.
33+
For more information about this error, try `rustc --explain E0412`.

src/test/ui/exclusive-range/exclusive_range_pattern_syntax_collision.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ fn main() {
44
match [5..4, 99..105, 43..44] {
55
[_, 99.., _] => {},
66
//~^ ERROR `X..` range patterns are not supported
7-
//~| ERROR arbitrary expressions aren't allowed in patterns
8-
//~| ERROR only char and numeric types are allowed in range patterns
7+
//~| ERROR mismatched types
98
_ => {},
109
}
1110
}

src/test/ui/exclusive-range/exclusive_range_pattern_syntax_collision.stderr

+8-12
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,17 @@ error: `X..` range patterns are not supported
44
LL | [_, 99.., _] => {},
55
| ^^^^ help: try using the maximum value for the type: `99..MAX`
66

7-
error: arbitrary expressions aren't allowed in patterns
7+
error[E0308]: mismatched types
88
--> $DIR/exclusive_range_pattern_syntax_collision.rs:5:13
99
|
10+
LL | match [5..4, 99..105, 43..44] {
11+
| ----------------------- this match expression has type `std::ops::Range<{integer}>`
1012
LL | [_, 99.., _] => {},
11-
| ^^^^
12-
13-
error[E0029]: only char and numeric types are allowed in range patterns
14-
--> $DIR/exclusive_range_pattern_syntax_collision.rs:5:13
15-
|
16-
LL | [_, 99.., _] => {},
17-
| ^^^^ ranges require char or numeric types
13+
| ^^^^ expected struct `std::ops::Range`, found integer
1814
|
19-
= note: start type: {integer}
20-
= note: end type: [type error]
15+
= note: expected type `std::ops::Range<{integer}>`
16+
found type `{integer}`
2117

22-
error: aborting due to 3 previous errors
18+
error: aborting due to 2 previous errors
2319

24-
For more information about this error, try `rustc --explain E0029`.
20+
For more information about this error, try `rustc --explain E0308`.

src/test/ui/exclusive-range/exclusive_range_pattern_syntax_collision2.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@ fn main() {
44
match [5..4, 99..105, 43..44] {
55
[_, 99..] => {},
66
//~^ ERROR `X..` range patterns are not supported
7-
//~| ERROR arbitrary expressions aren't allowed in patterns
87
//~| ERROR pattern requires 2 elements but array has 3
9-
//~| ERROR only char and numeric types are allowed in range patterns
8+
//~| ERROR mismatched types
109
_ => {},
1110
}
1211
}

src/test/ui/exclusive-range/exclusive_range_pattern_syntax_collision2.stderr

+9-13
Original file line numberDiff line numberDiff line change
@@ -4,28 +4,24 @@ error: `X..` range patterns are not supported
44
LL | [_, 99..] => {},
55
| ^^^^ help: try using the maximum value for the type: `99..MAX`
66

7-
error: arbitrary expressions aren't allowed in patterns
8-
--> $DIR/exclusive_range_pattern_syntax_collision2.rs:5:13
9-
|
10-
LL | [_, 99..] => {},
11-
| ^^^^
12-
137
error[E0527]: pattern requires 2 elements but array has 3
148
--> $DIR/exclusive_range_pattern_syntax_collision2.rs:5:9
159
|
1610
LL | [_, 99..] => {},
1711
| ^^^^^^^^^ expected 3 elements
1812

19-
error[E0029]: only char and numeric types are allowed in range patterns
13+
error[E0308]: mismatched types
2014
--> $DIR/exclusive_range_pattern_syntax_collision2.rs:5:13
2115
|
16+
LL | match [5..4, 99..105, 43..44] {
17+
| ----------------------- this match expression has type `std::ops::Range<{integer}>`
2218
LL | [_, 99..] => {},
23-
| ^^^^ ranges require char or numeric types
19+
| ^^^^ expected struct `std::ops::Range`, found integer
2420
|
25-
= note: start type: {integer}
26-
= note: end type: [type error]
21+
= note: expected type `std::ops::Range<{integer}>`
22+
found type `{integer}`
2723

28-
error: aborting due to 4 previous errors
24+
error: aborting due to 3 previous errors
2925

30-
Some errors have detailed explanations: E0029, E0527.
31-
For more information about an error, try `rustc --explain E0029`.
26+
Some errors have detailed explanations: E0308, E0527.
27+
For more information about an error, try `rustc --explain E0308`.

src/test/ui/exclusive-range/exclusive_range_pattern_syntax_collision3.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ fn main() {
44
match [5..4, 99..105, 43..44] {
55
[..9, 99..100, _] => {},
66
//~^ ERROR `..X` range patterns are not supported
7-
//~| ERROR arbitrary expressions aren't allowed in patterns
8-
//~| ERROR only char and numeric types are allowed in range patterns
7+
//~| ERROR mismatched types
98
//~| ERROR mismatched types
109
_ => {},
1110
}

src/test/ui/exclusive-range/exclusive_range_pattern_syntax_collision3.stderr

+8-13
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,16 @@ error: `..X` range patterns are not supported
44
LL | [..9, 99..100, _] => {},
55
| ^^^ help: try using the minimum value for the type: `MIN..9`
66

7-
error: arbitrary expressions aren't allowed in patterns
8-
--> $DIR/exclusive_range_pattern_syntax_collision3.rs:5:10
9-
|
10-
LL | [..9, 99..100, _] => {},
11-
| ^^^
12-
13-
error[E0029]: only char and numeric types are allowed in range patterns
7+
error[E0308]: mismatched types
148
--> $DIR/exclusive_range_pattern_syntax_collision3.rs:5:10
159
|
10+
LL | match [5..4, 99..105, 43..44] {
11+
| ----------------------- this match expression has type `std::ops::Range<{integer}>`
1612
LL | [..9, 99..100, _] => {},
17-
| ^^^ ranges require char or numeric types
13+
| ^^^ expected struct `std::ops::Range`, found integer
1814
|
19-
= note: start type: [type error]
20-
= note: end type: {integer}
15+
= note: expected type `std::ops::Range<{integer}>`
16+
found type `{integer}`
2117

2218
error[E0308]: mismatched types
2319
--> $DIR/exclusive_range_pattern_syntax_collision3.rs:5:15
@@ -30,7 +26,6 @@ LL | [..9, 99..100, _] => {},
3026
= note: expected type `std::ops::Range<{integer}>`
3127
found type `{integer}`
3228

33-
error: aborting due to 4 previous errors
29+
error: aborting due to 3 previous errors
3430

35-
Some errors have detailed explanations: E0029, E0308.
36-
For more information about an error, try `rustc --explain E0029`.
31+
For more information about this error, try `rustc --explain E0308`.

src/test/ui/parser/pat-tuple-4.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
fn main() {
2+
const PAT: u8 = 0;
3+
24
match 0 {
3-
(.. pat) => {}
5+
(.. PAT) => {}
46
//~^ ERROR `..X` range patterns are not supported
5-
//~| ERROR arbitrary expressions aren't allowed in patterns
6-
//~| ERROR cannot find value `pat` in this scope
77
//~| ERROR exclusive range pattern syntax is experimental
8-
//~| ERROR only char and numeric types are allowed in range patterns
98
}
109
}
10+
11+
const RECOVERY_WITNESS: () = 0; //~ ERROR mismatched types

src/test/ui/parser/pat-tuple-4.stderr

+14-26
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,28 @@
11
error: `..X` range patterns are not supported
2-
--> $DIR/pat-tuple-4.rs:3:10
2+
--> $DIR/pat-tuple-4.rs:5:10
33
|
4-
LL | (.. pat) => {}
5-
| ^^^^^^ help: try using the minimum value for the type: `MIN..pat`
6-
7-
error: arbitrary expressions aren't allowed in patterns
8-
--> $DIR/pat-tuple-4.rs:3:10
9-
|
10-
LL | (.. pat) => {}
11-
| ^^^^^^
12-
13-
error[E0425]: cannot find value `pat` in this scope
14-
--> $DIR/pat-tuple-4.rs:3:13
15-
|
16-
LL | (.. pat) => {}
17-
| ^^^ not found in this scope
4+
LL | (.. PAT) => {}
5+
| ^^^^^^ help: try using the minimum value for the type: `MIN..PAT`
186

197
error[E0658]: exclusive range pattern syntax is experimental
20-
--> $DIR/pat-tuple-4.rs:3:10
8+
--> $DIR/pat-tuple-4.rs:5:10
219
|
22-
LL | (.. pat) => {}
10+
LL | (.. PAT) => {}
2311
| ^^^^^^
2412
|
2513
= note: for more information, see https://github.com/rust-lang/rust/issues/37854
2614
= help: add `#![feature(exclusive_range_pattern)]` to the crate attributes to enable
2715

28-
error[E0029]: only char and numeric types are allowed in range patterns
29-
--> $DIR/pat-tuple-4.rs:3:10
16+
error[E0308]: mismatched types
17+
--> $DIR/pat-tuple-4.rs:11:30
3018
|
31-
LL | (.. pat) => {}
32-
| ^^^^^^ ranges require char or numeric types
19+
LL | const RECOVERY_WITNESS: () = 0;
20+
| ^ expected (), found integer
3321
|
34-
= note: start type: [type error]
35-
= note: end type: [type error]
22+
= note: expected type `()`
23+
found type `{integer}`
3624

37-
error: aborting due to 5 previous errors
25+
error: aborting due to 3 previous errors
3826

39-
Some errors have detailed explanations: E0029, E0425, E0658.
40-
For more information about an error, try `rustc --explain E0029`.
27+
Some errors have detailed explanations: E0308, E0658.
28+
For more information about an error, try `rustc --explain E0308`.

src/test/ui/parser/pat-tuple-5.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
fn main() {
2+
const PAT: u8 = 0;
3+
24
match (0, 1) {
3-
(pat ..) => {}
5+
(PAT ..) => {}
46
//~^ ERROR `X..` range patterns are not supported
5-
//~| ERROR arbitrary expressions aren't allowed in patterns
6-
//~| ERROR cannot find value `pat` in this scope
77
//~| ERROR exclusive range pattern syntax is experimental
8-
//~| ERROR only char and numeric types are allowed in range patterns
8+
//~| ERROR mismatched types
99
}
1010
}

src/test/ui/parser/pat-tuple-5.stderr

+16-26
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,30 @@
11
error: `X..` range patterns are not supported
2-
--> $DIR/pat-tuple-5.rs:3:10
2+
--> $DIR/pat-tuple-5.rs:5:10
33
|
4-
LL | (pat ..) => {}
5-
| ^^^^^^ help: try using the maximum value for the type: `pat..MAX`
6-
7-
error: arbitrary expressions aren't allowed in patterns
8-
--> $DIR/pat-tuple-5.rs:3:10
9-
|
10-
LL | (pat ..) => {}
11-
| ^^^^^^
12-
13-
error[E0425]: cannot find value `pat` in this scope
14-
--> $DIR/pat-tuple-5.rs:3:10
15-
|
16-
LL | (pat ..) => {}
17-
| ^^^ not found in this scope
4+
LL | (PAT ..) => {}
5+
| ^^^^^^ help: try using the maximum value for the type: `PAT..MAX`
186

197
error[E0658]: exclusive range pattern syntax is experimental
20-
--> $DIR/pat-tuple-5.rs:3:10
8+
--> $DIR/pat-tuple-5.rs:5:10
219
|
22-
LL | (pat ..) => {}
10+
LL | (PAT ..) => {}
2311
| ^^^^^^
2412
|
2513
= note: for more information, see https://github.com/rust-lang/rust/issues/37854
2614
= help: add `#![feature(exclusive_range_pattern)]` to the crate attributes to enable
2715

28-
error[E0029]: only char and numeric types are allowed in range patterns
29-
--> $DIR/pat-tuple-5.rs:3:10
16+
error[E0308]: mismatched types
17+
--> $DIR/pat-tuple-5.rs:5:10
3018
|
31-
LL | (pat ..) => {}
32-
| ^^^^^^ ranges require char or numeric types
19+
LL | match (0, 1) {
20+
| ------ this match expression has type `({integer}, {integer})`
21+
LL | (PAT ..) => {}
22+
| ^^^^^^ expected tuple, found u8
3323
|
34-
= note: start type: [type error]
35-
= note: end type: [type error]
24+
= note: expected type `({integer}, {integer})`
25+
found type `u8`
3626

37-
error: aborting due to 5 previous errors
27+
error: aborting due to 3 previous errors
3828

39-
Some errors have detailed explanations: E0029, E0425, E0658.
40-
For more information about an error, try `rustc --explain E0029`.
29+
Some errors have detailed explanations: E0308, E0658.
30+
For more information about an error, try `rustc --explain E0308`.

0 commit comments

Comments
 (0)