Unhelpful Error Messages for trait objects due to trait bounds #38124
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
D-newcomer-roadblock
Diagnostics: Confusing error or lint; hard to understand for new users.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
When a struct cannot be turned into a trait object due to a trait bound,
the compiler errors are very cryptic and unhelpful.
This results in the following errors (both on stable and nightly):
The problem lies with the
: Clone
trait bound, since Clone is not object safe.But the errors do not mention Clone at all, which leaves someone relatively new to Rust (like me) completely stranded and puzzled as to what might be the problem.
Better errors here would be a big win.
My ideal error would be something like:
The text was updated successfully, but these errors were encountered: