Cow trait bound without ToOwned produces odd "core::marker::Sized
is not implemented"
#31691
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
Incorrect code, because
Cow
requiresToOwned
on its parameter:Fixed:
Makes sense, but rustc's error for the first version is odd:
Into
doesn't requireT
to beSized
, and indeed in theCow
case it usually isn't.If I remove the
?Sized
fromT
, I getthe trait core::clone::Clone is not implemented for the type T
; stable produces this error for the original version too, along with theSized
error. On IRC, aatch suggested this was might be caused byimpl<T: Clone> ToOwned for T
. WhileClone
would be a sufficient bound due to that impl, it isn't necessary even for sized types, so that error too is misleading.The text was updated successfully, but these errors were encountered: