Diagnostic: suggest removing &mut instead of making the function argument mutable #76793
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
A-suggestion-diagnostics
Area: Suggestions generated by the compiler applied by `cargo fix`
C-bug
Category: This is a bug.
D-invalid-suggestion
Diagnostics: A structured suggestion resulting in incorrect code.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Uh oh!
There was an error while loading. Please reload this page.
For the following code:
The compiler provide the following error message:
Although the suggestion actually work. (Because of type coercion). I think it would be a little nicer to suggest removing &mut when calling the function.
My friend who is new to Rust got a similar suggestion (and misunderstood it) which made him confused.
The text was updated successfully, but these errors were encountered: