-
-
Notifications
You must be signed in to change notification settings - Fork 14.9k
Compiler suggests writing &mut mut foo in E0277 with .as_slice() #105645
Copy link
Copy link
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsD-invalid-suggestionDiagnostics: A structured suggestion resulting in incorrect code.Diagnostics: A structured suggestion resulting in incorrect code.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsD-invalid-suggestionDiagnostics: A structured suggestion resulting in incorrect code.Diagnostics: A structured suggestion resulting in incorrect code.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Given the following code:
The current output is:
Notice that the suggestion is to write
foo(&mut mut bref), which is both invalid syntax and not where the problem is located —as_slice()returns an&reference, so that call must be changed and no local syntax change can work.Occurs on stable 1.65.0 and 1.68.0-nightly (2022-12-11 bdb07a8)