-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Slices don't implement copy. #30483
Comments
It's seems like Copy requires Sized but i don't see a reason for that either. |
See #25776. |
The case where I noticed this is the following: trait Pod: Copy { } That is,
Both statements are true (given the definition of Pod used in lrs, unrelated to the Pod mentioned in the linked issue.) But I had to remove the impl<T: Pod> Pod for [T] which is necessary because I want to implement impl<T: Pod+?Sized> AsMut<[d8]> for T The comment by @nikomatsakis seems to mostly address the cases where you're using It seems that the built-in |
Any news on this one? Do we need RFC for it ? |
I am not sure whether I think we should permit sized types to be copy. I outlined some of my thoughts in this comment, which @eddyb already linked to. However, in the meantime, I've started to wonder if we should support moving and copying of DSTs just by using allocas at codegen time, which would allow us to make them work much more uniformly, almost like any other type. That would also make it fine for unsized types to be copy, though it might lead to footguns in some cases, but no different than a type like |
Triage: given niko's last comment, I think I'm going to close this one too. It's been a few years, and this feels very much like a "needs an RFC" thing to me. Let me know if that's wrong. Thanks! |
does not hold even though it could. Together with
size_of_val
, this would allow one to write various functions generic over all Copy types whether they are sized or unsized.The text was updated successfully, but these errors were encountered: