Skip to content

Commit 8749250

Browse files
committed
Use a label for catch-all pattern instead of note
1 parent 3480f6f commit 8749250

File tree

3 files changed

+10
-21
lines changed

3 files changed

+10
-21
lines changed

src/librustc_const_eval/check_match.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ fn check_arms<'a, 'tcx>(cx: &mut MatchCheckCtxt<'a, 'tcx>,
403403
// if we had a catchall pattern, hint at that
404404
if let Some(catchall) = catchall {
405405
err.span_label(pat.span, "this is an unreachable pattern");
406-
err.span_note(catchall, "this pattern matches any value");
406+
err.span_label(catchall, "this pattern matches any value");
407407
}
408408
err.emit();
409409
},

src/test/ui/issue-30302.stderr

+3-5
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ warning[E0170]: pattern binding `Nil` is named the same as one of the variants o
99
error: unreachable pattern
1010
--> $DIR/issue-30302.rs:25:9
1111
|
12+
23 | Nil => true,
13+
| --- this pattern matches any value
14+
24 | //~^ WARN pattern binding `Nil` is named the same as one of the variants of the type `Stack`
1215
25 | _ => false
1316
| ^ this is an unreachable pattern
1417
|
@@ -17,11 +20,6 @@ note: lint level defined here
1720
|
1821
14 | #![deny(unreachable_patterns)]
1922
| ^^^^^^^^^^^^^^^^^^^^
20-
note: this pattern matches any value
21-
--> $DIR/issue-30302.rs:23:9
22-
|
23-
23 | Nil => true,
24-
| ^^^
2523

2624
error: aborting due to previous error
2725

src/test/ui/issue-31221.stderr

+6-15
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
error: unreachable pattern
22
--> $DIR/issue-31221.rs:28:9
33
|
4+
27 | Var3 => (),
5+
| ---- this pattern matches any value
46
28 | Var2 => (),
57
| ^^^^ this is an unreachable pattern
68
|
@@ -9,35 +11,24 @@ note: lint level defined here
911
|
1012
14 | #![deny(unreachable_patterns)]
1113
| ^^^^^^^^^^^^^^^^^^^^
12-
note: this pattern matches any value
13-
--> $DIR/issue-31221.rs:27:9
14-
|
15-
27 | Var3 => (),
16-
| ^^^^
1714

1815
error: unreachable pattern
1916
--> $DIR/issue-31221.rs:34:9
2017
|
18+
33 | &Var3 => (),
19+
| ----- this pattern matches any value
2120
34 | &Var2 => (),
2221
| ^^^^^ this is an unreachable pattern
2322
|
24-
note: this pattern matches any value
25-
--> $DIR/issue-31221.rs:33:9
26-
|
27-
33 | &Var3 => (),
28-
| ^^^^^
2923

3024
error: unreachable pattern
3125
--> $DIR/issue-31221.rs:41:9
3226
|
27+
40 | (c, d) => (),
28+
| ------ this pattern matches any value
3329
41 | anything => ()
3430
| ^^^^^^^^ this is an unreachable pattern
3531
|
36-
note: this pattern matches any value
37-
--> $DIR/issue-31221.rs:40:9
38-
|
39-
40 | (c, d) => (),
40-
| ^^^^^^
4132

4233
error: aborting due to 3 previous errors
4334

0 commit comments

Comments
 (0)