Improve error message "cannot borrow immutable Box
content **f
as mutable"
#51157
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
This error message seems a bit weird, because the problem isn't that box content isn't mutable, but the box itself is immutable. Changing the line 2 to
let mut f: …
fixes the issue. Notice that the same error message is shown if we constructf
within the function.I think the error message should be improved to look similar to the following (not sure on the phrasing of the error itself):
The text was updated successfully, but these errors were encountered: