Confusing error message suggestion when invoking mutable trait method implemented by a mutable reference #83241
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.
Given the following code: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=e7ec4e3526917cc9fe6d42a43e2a9a6a
The current output is:
The suggestion to remove
&mut
is quite confusing and does not appear actionable unless it means removing&mut
from the declaration offn bar(&mut self);
. I believe the correct fix is to add amut
before the argument inbaz
:Ideally the output should be similar to the case where the trait is implemented by something that is not a mutable reference:
The text was updated successfully, but these errors were encountered: