Incorrect "closure bodies that contain statements must be surrounded by braces" error in unrelatedly invalid code #127223
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Code
Current output
Desired output
Rationale and extra context
This error is unrelated to the closure, and indeed, applying the suggestion leaves us with:
Which now has an improperly closed brace. The correct code would (most likely) be
(value)
The original code I had made the suggestion even weirder since the closure was an argument to a Higher Order Function (instead of bound to a variable) and the last line was a function call with a
;
after its argument (instead of a paren expression), which happened due to a typo 😅. Just in case something following that structure would make for a useful test case as well:Other cases
No response
Rust Version
Anything else?
No response
The text was updated successfully, but these errors were encountered: