|
|
|
|
|
by jhugo
341 days ago
|
|
> we cannot just require all generic parameters to be Clone, as we cannot assume they are used in such a way that requires them to be cloned. No, this is backwards. We have to require all generic parameters are Clone, as we cannot assume that any are not used in a way that requires them to be Clone. > The reason this is the way it is is probably because Rust's type system wasn't powerful enough for this to be implemented back in the pre-1.0 days. Or it was just a simple oversight that got stabilized. The type system can't know whether you call `T::clone()` in a method somewhere. |
|
It’s not about that, it’s about type system power as the article said. In former days there was no way to express the constraint; but these days you can <https://play.rust-lang.org/?gist=d1947d81a126df84f3c91fb29b5...>: