Arity errors suggest incorrect fix when there are name errors #126246
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
A-suggestion-diagnostics
Area: Suggestions generated by the compiler applied by `cargo fix`
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.
Code
Current output
Desired output
Rationale and extra context
It's surprising that rustc suggests removing an argument whose type matches the expected type, in favour of a value that doesn't exist.
I encountered this when editing a struct and its methods to remove a field, where
self.foo(self.old_field, argument)
incorrectly suggested removingargument
whenfoo
no longer took two arguments.Other cases
No response
Rust Version
Anything else?
No response
The text was updated successfully, but these errors were encountered: