Use a label for catch-all pattern instead of note
This commit is contained in:
parent
3480f6f068
commit
8749250327
@ -403,7 +403,7 @@ fn check_arms<'a, 'tcx>(cx: &mut MatchCheckCtxt<'a, 'tcx>,
|
|||||||
// if we had a catchall pattern, hint at that
|
// if we had a catchall pattern, hint at that
|
||||||
if let Some(catchall) = catchall {
|
if let Some(catchall) = catchall {
|
||||||
err.span_label(pat.span, "this is an unreachable pattern");
|
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();
|
err.emit();
|
||||||
},
|
},
|
||||||
|
@ -9,6 +9,9 @@ warning[E0170]: pattern binding `Nil` is named the same as one of the variants o
|
|||||||
error: unreachable pattern
|
error: unreachable pattern
|
||||||
--> $DIR/issue-30302.rs:25:9
|
--> $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
|
25 | _ => false
|
||||||
| ^ this is an unreachable pattern
|
| ^ this is an unreachable pattern
|
||||||
|
|
|
|
||||||
@ -17,11 +20,6 @@ note: lint level defined here
|
|||||||
|
|
|
|
||||||
14 | #![deny(unreachable_patterns)]
|
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
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
error: unreachable pattern
|
error: unreachable pattern
|
||||||
--> $DIR/issue-31221.rs:28:9
|
--> $DIR/issue-31221.rs:28:9
|
||||||
|
|
|
|
||||||
|
27 | Var3 => (),
|
||||||
|
| ---- this pattern matches any value
|
||||||
28 | Var2 => (),
|
28 | Var2 => (),
|
||||||
| ^^^^ this is an unreachable pattern
|
| ^^^^ this is an unreachable pattern
|
||||||
|
|
|
|
||||||
@ -9,35 +11,24 @@ note: lint level defined here
|
|||||||
|
|
|
|
||||||
14 | #![deny(unreachable_patterns)]
|
14 | #![deny(unreachable_patterns)]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^
|
||||||
note: this pattern matches any value
|
|
||||||
--> $DIR/issue-31221.rs:27:9
|
|
||||||
|
|
|
||||||
27 | Var3 => (),
|
|
||||||
| ^^^^
|
|
||||||
|
|
||||||
error: unreachable pattern
|
error: unreachable pattern
|
||||||
--> $DIR/issue-31221.rs:34:9
|
--> $DIR/issue-31221.rs:34:9
|
||||||
|
|
|
|
||||||
|
33 | &Var3 => (),
|
||||||
|
| ----- this pattern matches any value
|
||||||
34 | &Var2 => (),
|
34 | &Var2 => (),
|
||||||
| ^^^^^ this is an unreachable pattern
|
| ^^^^^ this is an unreachable pattern
|
||||||
|
|
|
|
||||||
note: this pattern matches any value
|
|
||||||
--> $DIR/issue-31221.rs:33:9
|
|
||||||
|
|
|
||||||
33 | &Var3 => (),
|
|
||||||
| ^^^^^
|
|
||||||
|
|
||||||
error: unreachable pattern
|
error: unreachable pattern
|
||||||
--> $DIR/issue-31221.rs:41:9
|
--> $DIR/issue-31221.rs:41:9
|
||||||
|
|
|
|
||||||
|
40 | (c, d) => (),
|
||||||
|
| ------ this pattern matches any value
|
||||||
41 | anything => ()
|
41 | anything => ()
|
||||||
| ^^^^^^^^ this is an unreachable pattern
|
| ^^^^^^^^ 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
|
error: aborting due to 3 previous errors
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user