Omitting Clone
bound on &impl Trait
leads to correct but unhelpful error
#121524
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
D-confusing
Diagnostics: Confusing error or lint that should be reworked.
S-has-mcve
Status: A Minimal Complete and Verifiable Example has been found for this issue
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
The current error message does not guide the programmer to the correct solution, which is to add a
Clone
bound to the type constraints of the generic parameter.Other cases
Moving the inline call to
thing.clone()
onto its own line improves the error, but it's still misleading:Removing the call to
drops_impl_owned()
allows compilation to proceed to the warning stage, which generates a warning that actually explains the problem (incorporated into Desired output, above):Rust Version
Anything else?
I've set up a minimal reproducer repo for each of the above cases at https://github.com/overhacked/impl-ref-reproducer
The text was updated successfully, but these errors were encountered: