Skip to content

Commit

Permalink
Rollup merge of rust-lang#108477 - y21:replace-semi-with-comma-sugg, …
Browse files Browse the repository at this point in the history
…r=compiler-errors

Make `match` arm comma suggestion more clear

Fixes rust-lang#108472
  • Loading branch information
matthiaskrgr committed Feb 26, 2023
2 parents 71ddfb0 + 32da026 commit 98650e8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion compiler/rustc_parse/locales/en-US.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 7 additions & 3 deletions tests/ui/parser/match-arm-without-braces.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 98650e8

Please sign in to comment.