diff --git a/src/librustc_const_eval/check_match.rs b/src/librustc_const_eval/check_match.rs index e22f7f14164..971da0911e7 100644 --- a/src/librustc_const_eval/check_match.rs +++ b/src/librustc_const_eval/check_match.rs @@ -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(); }, diff --git a/src/test/ui/issue-30302.stderr b/src/test/ui/issue-30302.stderr index e86b588aad2..52bc2645eed 100644 --- a/src/test/ui/issue-30302.stderr +++ b/src/test/ui/issue-30302.stderr @@ -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 diff --git a/src/test/ui/issue-31221.stderr b/src/test/ui/issue-31221.stderr index ccc1df04ff7..7a0dc7c0007 100644 --- a/src/test/ui/issue-31221.stderr +++ b/src/test/ui/issue-31221.stderr @@ -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