Bad suggestion for &mut in combination with Default (maybe also other traits) #100289
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:
The current output is:
This output is confusing, because changing the type to e.g. i64 won't solve the problem and instead cause a lot of new ones. For a HashMap, I currently get the suggestion to use a HashSet. The correct solution would be to recognize that
usize: Default
and suggest to add a&mut
. This may generalize to other similar situations (&
) or traits.The text was updated successfully, but these errors were encountered: