Skip to content

Commit 4fc5758

Browse files
committed
Update existing tests with more precise error messages
1 parent e018268 commit 4fc5758

19 files changed

+102
-76
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
warning: unreachable pattern
2+
--> $DIR/vec-matching-autoslice.rs:31:9
3+
|
4+
LL | ([_, _], _) => panic!(),
5+
| ^^^^^^^^^^^
6+
|
7+
= note: #[warn(unreachable_patterns)] on by default
8+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
warning: unreachable pattern
2+
--> $DIR/match-range.rs:47:7
3+
|
4+
LL | _ => panic!("should match float range")
5+
| ^
6+
|
7+
= note: #[warn(unreachable_patterns)] on by default
8+
9+
warning: unreachable pattern
10+
--> $DIR/match-range.rs:55:9
11+
|
12+
LL | _ => {},
13+
| ^
14+
15+
warning: unreachable pattern
16+
--> $DIR/match-range.rs:59:9
17+
|
18+
LL | _ => panic!("should match the range start"),
19+
| ^
20+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
warning: unreachable pattern
2+
--> $DIR/issue-15881-model-lexer-dotdotdot.rs:41:7
3+
|
4+
LL | _ => panic!("should match float range")
5+
| ^
6+
|
7+
= note: #[warn(unreachable_patterns)] on by default
8+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
warning: unreachable pattern
2+
--> $DIR/issue-7222.rs:20:9
3+
|
4+
LL | _ => ()
5+
| ^
6+
|
7+
= note: #[warn(unreachable_patterns)] on by default
8+

src/test/ui/consts/const-match-check.eval1.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
error[E0005]: refutable pattern in local binding: `_` not covered
1+
error[E0005]: refutable pattern in local binding: `-2147483648i32..=-1i32` not covered
22
--> $DIR/const-match-check.rs:35:15
33
|
44
LL | A = { let 0 = 0; 0 },
5-
| ^ pattern `_` not covered
5+
| ^ pattern `-2147483648i32..=-1i32` not covered
66

77
error: aborting due to previous error
88

src/test/ui/consts/const-match-check.eval2.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
error[E0005]: refutable pattern in local binding: `_` not covered
1+
error[E0005]: refutable pattern in local binding: `-2147483648i32..=-1i32` not covered
22
--> $DIR/const-match-check.rs:41:24
33
|
44
LL | let x: [i32; { let 0 = 0; 0 }] = [];
5-
| ^ pattern `_` not covered
5+
| ^ pattern `-2147483648i32..=-1i32` not covered
66

77
error: aborting due to previous error
88

src/test/ui/consts/const-match-check.matchck.stderr

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
1-
error[E0005]: refutable pattern in local binding: `_` not covered
1+
error[E0005]: refutable pattern in local binding: `-2147483648i32..=-1i32` not covered
22
--> $DIR/const-match-check.rs:14:22
33
|
44
LL | const X: i32 = { let 0 = 0; 0 };
5-
| ^ pattern `_` not covered
5+
| ^ pattern `-2147483648i32..=-1i32` not covered
66

7-
error[E0005]: refutable pattern in local binding: `_` not covered
7+
error[E0005]: refutable pattern in local binding: `-2147483648i32..=-1i32` not covered
88
--> $DIR/const-match-check.rs:18:23
99
|
1010
LL | static Y: i32 = { let 0 = 0; 0 };
11-
| ^ pattern `_` not covered
11+
| ^ pattern `-2147483648i32..=-1i32` not covered
1212

13-
error[E0005]: refutable pattern in local binding: `_` not covered
13+
error[E0005]: refutable pattern in local binding: `-2147483648i32..=-1i32` not covered
1414
--> $DIR/const-match-check.rs:23:26
1515
|
1616
LL | const X: i32 = { let 0 = 0; 0 };
17-
| ^ pattern `_` not covered
17+
| ^ pattern `-2147483648i32..=-1i32` not covered
1818

19-
error[E0005]: refutable pattern in local binding: `_` not covered
19+
error[E0005]: refutable pattern in local binding: `-2147483648i32..=-1i32` not covered
2020
--> $DIR/const-match-check.rs:29:26
2121
|
2222
LL | const X: i32 = { let 0 = 0; 0 };
23-
| ^ pattern `_` not covered
23+
| ^ pattern `-2147483648i32..=-1i32` not covered
2424

2525
error: aborting due to 4 previous errors
2626

src/test/ui/consts/const-pattern-irrefutable.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ use foo::d;
1919
const a: u8 = 2;
2020

2121
fn main() {
22-
let a = 4; //~ ERROR refutable pattern in local binding: `_` not covered
23-
let c = 4; //~ ERROR refutable pattern in local binding: `_` not covered
24-
let d = 4; //~ ERROR refutable pattern in local binding: `_` not covered
22+
let a = 4; //~ ERROR refutable pattern in local binding: `0u8..=1u8` not covered
23+
let c = 4; //~ ERROR refutable pattern in local binding: `0u8..=1u8` not covered
24+
let d = 4; //~ ERROR refutable pattern in local binding: `0u8..=1u8` not covered
2525
fn f() {} // Check that the `NOTE`s still work with an item here (c.f. issue #35115).
2626
}

src/test/ui/consts/const-pattern-irrefutable.stderr

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
error[E0005]: refutable pattern in local binding: `_` not covered
1+
error[E0005]: refutable pattern in local binding: `0u8..=1u8` not covered
22
--> $DIR/const-pattern-irrefutable.rs:22:9
33
|
4-
LL | let a = 4; //~ ERROR refutable pattern in local binding: `_` not covered
4+
LL | let a = 4; //~ ERROR refutable pattern in local binding: `0u8..=1u8` not covered
55
| ^ interpreted as a constant pattern, not new variable
66

7-
error[E0005]: refutable pattern in local binding: `_` not covered
7+
error[E0005]: refutable pattern in local binding: `0u8..=1u8` not covered
88
--> $DIR/const-pattern-irrefutable.rs:23:9
99
|
10-
LL | let c = 4; //~ ERROR refutable pattern in local binding: `_` not covered
10+
LL | let c = 4; //~ ERROR refutable pattern in local binding: `0u8..=1u8` not covered
1111
| ^ interpreted as a constant pattern, not new variable
1212

13-
error[E0005]: refutable pattern in local binding: `_` not covered
13+
error[E0005]: refutable pattern in local binding: `0u8..=1u8` not covered
1414
--> $DIR/const-pattern-irrefutable.rs:24:9
1515
|
16-
LL | let d = 4; //~ ERROR refutable pattern in local binding: `_` not covered
16+
LL | let d = 4; //~ ERROR refutable pattern in local binding: `0u8..=1u8` not covered
1717
| ^ interpreted as a constant pattern, not new variable
1818

1919
error: aborting due to 3 previous errors

src/test/ui/exhaustive_integer_patterns.stderr

+14-14
Original file line numberDiff line numberDiff line change
@@ -1,83 +1,83 @@
11
error: unreachable pattern
2-
--> $DIR/exhaustive_integer_patterns.rs:32:9
2+
--> $DIR/exhaustive_integer_patterns.rs:33:9
33
|
44
LL | 200 => {} //~ ERROR unreachable pattern
55
| ^^^
66
|
77
note: lint level defined here
8-
--> $DIR/exhaustive_integer_patterns.rs:13:9
8+
--> $DIR/exhaustive_integer_patterns.rs:14:9
99
|
1010
LL | #![deny(unreachable_patterns)]
1111
| ^^^^^^^^^^^^^^^^^^^^
1212

1313
error[E0004]: non-exhaustive patterns: `128u8..=255u8` not covered
14-
--> $DIR/exhaustive_integer_patterns.rs:37:11
14+
--> $DIR/exhaustive_integer_patterns.rs:38:11
1515
|
1616
LL | match x { //~ ERROR non-exhaustive patterns
1717
| ^ pattern `128u8..=255u8` not covered
1818

1919
error[E0004]: non-exhaustive patterns: `11u8..=19u8`, `31u8..=34u8`, `36u8..=69u8` and 1 more not covered
20-
--> $DIR/exhaustive_integer_patterns.rs:42:11
20+
--> $DIR/exhaustive_integer_patterns.rs:43:11
2121
|
2222
LL | match x { //~ ERROR non-exhaustive patterns
2323
| ^ patterns `11u8..=19u8`, `31u8..=34u8`, `36u8..=69u8` and 1 more not covered
2424

2525
error: unreachable pattern
26-
--> $DIR/exhaustive_integer_patterns.rs:53:9
26+
--> $DIR/exhaustive_integer_patterns.rs:54:9
2727
|
2828
LL | -2..=20 => {} //~ ERROR unreachable pattern
2929
| ^^^^^^^
3030

3131
error[E0004]: non-exhaustive patterns: `-128i8..=-8i8`, `-6i8`, `121i8..=124i8` and 1 more not covered
32-
--> $DIR/exhaustive_integer_patterns.rs:50:11
32+
--> $DIR/exhaustive_integer_patterns.rs:51:11
3333
|
3434
LL | match x { //~ ERROR non-exhaustive patterns
3535
| ^ patterns `-128i8..=-8i8`, `-6i8`, `121i8..=124i8` and 1 more not covered
3636

3737
error[E0004]: non-exhaustive patterns: `-128i8` not covered
38-
--> $DIR/exhaustive_integer_patterns.rs:99:11
38+
--> $DIR/exhaustive_integer_patterns.rs:100:11
3939
|
4040
LL | match 0i8 { //~ ERROR non-exhaustive patterns
4141
| ^^^ pattern `-128i8` not covered
4242

4343
error[E0004]: non-exhaustive patterns: `0i16` not covered
44-
--> $DIR/exhaustive_integer_patterns.rs:107:11
44+
--> $DIR/exhaustive_integer_patterns.rs:108:11
4545
|
4646
LL | match 0i16 { //~ ERROR non-exhaustive patterns
4747
| ^^^^ pattern `0i16` not covered
4848

4949
error[E0004]: non-exhaustive patterns: `128u8..=255u8` not covered
50-
--> $DIR/exhaustive_integer_patterns.rs:125:11
50+
--> $DIR/exhaustive_integer_patterns.rs:126:11
5151
|
5252
LL | match 0u8 { //~ ERROR non-exhaustive patterns
5353
| ^^^ pattern `128u8..=255u8` not covered
5454

5555
error[E0004]: non-exhaustive patterns: `(0u8, Some(_))` and `(2u8..=255u8, Some(_))` not covered
56-
--> $DIR/exhaustive_integer_patterns.rs:137:11
56+
--> $DIR/exhaustive_integer_patterns.rs:138:11
5757
|
5858
LL | match (0u8, Some(())) { //~ ERROR non-exhaustive patterns
5959
| ^^^^^^^^^^^^^^^ patterns `(0u8, Some(_))` and `(2u8..=255u8, Some(_))` not covered
6060

6161
error[E0004]: non-exhaustive patterns: `(126u8..=127u8, false)` not covered
62-
--> $DIR/exhaustive_integer_patterns.rs:142:11
62+
--> $DIR/exhaustive_integer_patterns.rs:143:11
6363
|
6464
LL | match (0u8, true) { //~ ERROR non-exhaustive patterns
6565
| ^^^^^^^^^^^ pattern `(126u8..=127u8, false)` not covered
6666

6767
error[E0004]: non-exhaustive patterns: `340282366920938463463374607431768211455u128` not covered
68-
--> $DIR/exhaustive_integer_patterns.rs:162:11
68+
--> $DIR/exhaustive_integer_patterns.rs:163:11
6969
|
7070
LL | match 0u128 { //~ ERROR non-exhaustive patterns
7171
| ^^^^^ pattern `340282366920938463463374607431768211455u128` not covered
7272

7373
error[E0004]: non-exhaustive patterns: `5u128..=340282366920938463463374607431768211455u128` not covered
74-
--> $DIR/exhaustive_integer_patterns.rs:166:11
74+
--> $DIR/exhaustive_integer_patterns.rs:167:11
7575
|
7676
LL | match 0u128 { //~ ERROR non-exhaustive patterns
7777
| ^^^^^ pattern `5u128..=340282366920938463463374607431768211455u128` not covered
7878

7979
error[E0004]: non-exhaustive patterns: `0u128..=3u128` not covered
80-
--> $DIR/exhaustive_integer_patterns.rs:170:11
80+
--> $DIR/exhaustive_integer_patterns.rs:171:11
8181
|
8282
LL | match 0u128 { //~ ERROR non-exhaustive patterns
8383
| ^^^^^ pattern `0u128..=3u128` not covered

src/test/ui/feature-gate-exhaustive_integer_patterns.rs

-16
This file was deleted.

src/test/ui/feature-gate-exhaustive_integer_patterns.stderr

-9
This file was deleted.

src/test/ui/for/for-loop-refutable-pattern-error-message.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
error[E0005]: refutable pattern in `for` loop binding: `&_` not covered
1+
error[E0005]: refutable pattern in `for` loop binding: `&-2147483648i32..=0i32` not covered
22
--> $DIR/for-loop-refutable-pattern-error-message.rs:12:9
33
|
44
LL | for &1 in [1].iter() {} //~ ERROR refutable pattern in `for` loop binding
5-
| ^^ pattern `&_` not covered
5+
| ^^ pattern `&-2147483648i32..=0i32` not covered
66

77
error: aborting due to previous error
88

src/test/ui/match/match-non-exhaustive.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
error[E0004]: non-exhaustive patterns: `_` not covered
1+
error[E0004]: non-exhaustive patterns: `-2147483648i32..=0i32` and `2i32..=2147483647i32` not covered
22
--> $DIR/match-non-exhaustive.rs:12:11
33
|
44
LL | match 0 { 1 => () } //~ ERROR non-exhaustive patterns
5-
| ^ pattern `_` not covered
5+
| ^ patterns `-2147483648i32..=0i32` and `2i32..=2147483647i32` not covered
66

77
error[E0004]: non-exhaustive patterns: `_` not covered
88
--> $DIR/match-non-exhaustive.rs:13:11

src/test/ui/match/match-range-fail-dominate.stderr

+7-1
Original file line numberDiff line numberDiff line change
@@ -62,5 +62,11 @@ error: unreachable pattern
6262
LL | 0.02f64 => {}
6363
| ^^^^^^^
6464

65-
error: aborting due to 5 previous errors
65+
error: unreachable pattern
66+
--> $DIR/match-range-fail-dominate.rs:47:7
67+
|
68+
LL | _ => {}
69+
| ^
70+
71+
error: aborting due to 6 previous errors
6672

src/test/ui/non-exhaustive/non-exhaustive-match.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ fn main() {
2222
match Some(10) { //~ ERROR non-exhaustive patterns: `Some(_)` not covered
2323
None => {}
2424
}
25-
match (2, 3, 4) { //~ ERROR non-exhaustive patterns: `(_, _, _)` not covered
25+
match (2, 3, 4) { //~ ERROR non-exhaustive patterns: `(_, _, -2147483648i32..=3i32)`
26+
// and `(_, _, 5i32..=2147483647i32)` not covered
2627
(_, _, 4) => {}
2728
}
2829
match (t::a, t::a) { //~ ERROR non-exhaustive patterns: `(a, a)` not covered

src/test/ui/non-exhaustive/non-exhaustive-match.stderr

+7-7
Original file line numberDiff line numberDiff line change
@@ -16,32 +16,32 @@ error[E0004]: non-exhaustive patterns: `Some(_)` not covered
1616
LL | match Some(10) { //~ ERROR non-exhaustive patterns: `Some(_)` not covered
1717
| ^^^^^^^^ pattern `Some(_)` not covered
1818

19-
error[E0004]: non-exhaustive patterns: `(_, _, _)` not covered
19+
error[E0004]: non-exhaustive patterns: `(_, _, -2147483648i32..=3i32)` and `(_, _, 5i32..=2147483647i32)` not covered
2020
--> $DIR/non-exhaustive-match.rs:25:11
2121
|
22-
LL | match (2, 3, 4) { //~ ERROR non-exhaustive patterns: `(_, _, _)` not covered
23-
| ^^^^^^^^^ pattern `(_, _, _)` not covered
22+
LL | match (2, 3, 4) { //~ ERROR non-exhaustive patterns: `(_, _, -2147483648i32..=3i32)`
23+
| ^^^^^^^^^ patterns `(_, _, -2147483648i32..=3i32)` and `(_, _, 5i32..=2147483647i32)` not covered
2424

2525
error[E0004]: non-exhaustive patterns: `(a, a)` not covered
26-
--> $DIR/non-exhaustive-match.rs:28:11
26+
--> $DIR/non-exhaustive-match.rs:29:11
2727
|
2828
LL | match (t::a, t::a) { //~ ERROR non-exhaustive patterns: `(a, a)` not covered
2929
| ^^^^^^^^^^^^ pattern `(a, a)` not covered
3030

3131
error[E0004]: non-exhaustive patterns: `b` not covered
32-
--> $DIR/non-exhaustive-match.rs:32:11
32+
--> $DIR/non-exhaustive-match.rs:33:11
3333
|
3434
LL | match t::a { //~ ERROR non-exhaustive patterns: `b` not covered
3535
| ^^^^ pattern `b` not covered
3636

3737
error[E0004]: non-exhaustive patterns: `[]` not covered
38-
--> $DIR/non-exhaustive-match.rs:43:11
38+
--> $DIR/non-exhaustive-match.rs:44:11
3939
|
4040
LL | match *vec { //~ ERROR non-exhaustive patterns: `[]` not covered
4141
| ^^^^ pattern `[]` not covered
4242

4343
error[E0004]: non-exhaustive patterns: `[_, _, _, _]` not covered
44-
--> $DIR/non-exhaustive-match.rs:56:11
44+
--> $DIR/non-exhaustive-match.rs:57:11
4545
|
4646
LL | match *vec { //~ ERROR non-exhaustive patterns: `[_, _, _, _]` not covered
4747
| ^^^^ pattern `[_, _, _, _]` not covered

src/test/ui/refutable-pattern-errors.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ fn func((1, (Some(1), 2..=3)): (isize, (Option<isize>, isize))) { }
1414

1515
fn main() {
1616
let (1, (Some(1), 2..=3)) = (1, (None, 2));
17-
//~^ ERROR refutable pattern in local binding: `(_, _)` not covered
17+
//~^ ERROR refutable pattern in local binding: `(-2147483648i32..=0i32, _)` not covered
1818
}

src/test/ui/refutable-pattern-errors.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ error[E0005]: refutable pattern in function argument: `(_, _)` not covered
44
LL | fn func((1, (Some(1), 2..=3)): (isize, (Option<isize>, isize))) { }
55
| ^^^^^^^^^^^^^^^^^^^^^ pattern `(_, _)` not covered
66

7-
error[E0005]: refutable pattern in local binding: `(_, _)` not covered
7+
error[E0005]: refutable pattern in local binding: `(-2147483648i32..=0i32, _)` not covered
88
--> $DIR/refutable-pattern-errors.rs:16:9
99
|
1010
LL | let (1, (Some(1), 2..=3)) = (1, (None, 2));
11-
| ^^^^^^^^^^^^^^^^^^^^^ pattern `(_, _)` not covered
11+
| ^^^^^^^^^^^^^^^^^^^^^ pattern `(-2147483648i32..=0i32, _)` not covered
1212

1313
error: aborting due to 2 previous errors
1414

0 commit comments

Comments
 (0)