Use a label for catch-all pattern instead of note

This commit is contained in:
Esteban Küber 2017-12-19 19:11:02 -08:00
parent 3480f6f068
commit 8749250327
3 changed files with 10 additions and 21 deletions

View file

@ -403,7 +403,7 @@ fn check_arms<'a, 'tcx>(cx: &mut MatchCheckCtxt<'a, 'tcx>,
// if we had a catchall pattern, hint at that
if let Some(catchall) = catchall {
err.span_label(pat.span, "this is an unreachable pattern");
err.span_note(catchall, "this pattern matches any value");
err.span_label(catchall, "this pattern matches any value");
}
err.emit();
},

View file

@ -9,6 +9,9 @@ warning[E0170]: pattern binding `Nil` is named the same as one of the variants o
error: unreachable pattern
--> $DIR/issue-30302.rs:25:9
|
23 | Nil => true,
| --- this pattern matches any value
24 | //~^ WARN pattern binding `Nil` is named the same as one of the variants of the type `Stack`
25 | _ => false
| ^ this is an unreachable pattern
|
@ -17,11 +20,6 @@ note: lint level defined here
|
14 | #![deny(unreachable_patterns)]
| ^^^^^^^^^^^^^^^^^^^^
note: this pattern matches any value
--> $DIR/issue-30302.rs:23:9
|
23 | Nil => true,
| ^^^
error: aborting due to previous error

View file

@ -1,6 +1,8 @@
error: unreachable pattern
--> $DIR/issue-31221.rs:28:9
|
27 | Var3 => (),
| ---- this pattern matches any value
28 | Var2 => (),
| ^^^^ this is an unreachable pattern
|
@ -9,35 +11,24 @@ note: lint level defined here
|
14 | #![deny(unreachable_patterns)]
| ^^^^^^^^^^^^^^^^^^^^
note: this pattern matches any value
--> $DIR/issue-31221.rs:27:9
|
27 | Var3 => (),
| ^^^^
error: unreachable pattern
--> $DIR/issue-31221.rs:34:9
|
33 | &Var3 => (),
| ----- this pattern matches any value
34 | &Var2 => (),
| ^^^^^ this is an unreachable pattern
|
note: this pattern matches any value
--> $DIR/issue-31221.rs:33:9
|
33 | &Var3 => (),
| ^^^^^
error: unreachable pattern
--> $DIR/issue-31221.rs:41:9
|
40 | (c, d) => (),
| ------ this pattern matches any value
41 | anything => ()
| ^^^^^^^^ this is an unreachable pattern
|
note: this pattern matches any value
--> $DIR/issue-31221.rs:40:9
|
40 | (c, d) => (),
| ^^^^^^
error: aborting due to 3 previous errors