E0308 suggestion can lead to unnecessary clones #114050
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.
Code
Current output
Desired output
Rationale and extra context
This works as expected when
a
andb
are swapped, but with this ordering,cloned
is suggested, which leads to an allocation/copy which will be immediately freed and is entirely avoidable.Other cases
a
andb
swapped leads to the correct output.Anything else?
Tested on
nightly 2023-07-24 31395ec38250b60b380f
The text was updated successfully, but these errors were encountered: