impl<T> Clone for T where T: Copy

#1

Sorry i can’t remember, but what stopped us from having the definition as below.in libcore?

    impl<T> Clone for T where T: Copy {
        fn clone(&self) -> T {
            *self
        }
    }

EDIT: And remove Copy's supertrait Clone, of course!

1 Like

#2

Take something like Option<T> which conditionally implements Copy – if that implies Clone, then how can it implement Clone apart from that?

0 Likes

#3

Why does it need to? When it implements Copy, it will automatically implement Clone given the impl in the OP, doesn’t it?

0 Likes

#4

Oh the impls overlapped (although their effect will be the same), yes i see what you mean.

0 Likes

#5

This is the kind of thing we want to do if we could get specialization to a place we could stabilize it.

5 Likes

#6
1 Like