From 32da026c35d07e1e256421b0860d136f01ee3bf0 Mon Sep 17 00:00:00 2001 From: y21 <30553356+y21@users.noreply.github.com> Date: Sun, 26 Feb 2023 01:39:43 +0100 Subject: [PATCH] generalize help message --- compiler/rustc_parse/locales/en-US.ftl | 2 +- tests/ui/parser/match-arm-without-braces.stderr | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/compiler/rustc_parse/locales/en-US.ftl b/compiler/rustc_parse/locales/en-US.ftl index a31b1f6ac1a..4ddeeed5b7e 100644 --- a/compiler/rustc_parse/locales/en-US.ftl +++ b/compiler/rustc_parse/locales/en-US.ftl @@ -220,7 +220,7 @@ parse_match_arm_body_without_braces = `match` arm body without braces [one] statement *[other] statements } with a body - .suggestion_use_comma_not_semicolon = use a comma to end a `match` arm expression + .suggestion_use_comma_not_semicolon = replace `;` with `,` to end a `match` arm expression parse_inclusive_range_extra_equals = unexpected `=` after inclusive range .suggestion_remove_eq = use `..=` instead diff --git a/tests/ui/parser/match-arm-without-braces.stderr b/tests/ui/parser/match-arm-without-braces.stderr index 37d55aa53f8..ee1c8e562fc 100644 --- a/tests/ui/parser/match-arm-without-braces.stderr +++ b/tests/ui/parser/match-arm-without-braces.stderr @@ -2,10 +2,14 @@ error: `match` arm body without braces --> $DIR/match-arm-without-braces.rs:26:27 | LL | Some(Val::Foo) => 3; - | -- ^- help: use a comma to end a `match` arm expression: `,` - | | | - | | this statement is not surrounded by a body + | -- ^ this statement is not surrounded by a body + | | | while parsing the `match` arm starting here + | +help: replace `;` with `,` to end a `match` arm expression + | +LL | Some(Val::Foo) => 3, + | ~ error: `match` arm body without braces --> $DIR/match-arm-without-braces.rs:31:11