-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Clone is not defined for [_; 256] #30244
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
Comments
Clone is not implemented for |
I'm assuming that trying to call |
In certain contexts, such as |
Ah, the bound was |
If only we had type level integers so we could just properly implement Clone for all fixed size array sizes without massive bloat. |
Revert "PR #30130 Implement `Clone` for more arrays" This reverts commit e22a64e. This caused a regression such that types like `[[u8; 256]; 4]` no longer implemented Clone. This previously worked due to Clone for `[T; N]` (N in 0 to 32) being implemented for T: Copy. Due to fixed size arrays not implementing Clone for sizes above 32, the new implementation requiring T: Clone would not allow `[[u8; 256]; 4]` to be Clone. Fixes #30244 Due to changing back, this is technically a [breaking-change], albeit for a behavior that existed for a very short time.
It doesn't even requires actual numbers, most of impls act on "size-erased" arrays. |
@petrochenkov how would that work? Don't you need to loop N times to do the actual clone? |
Something like:
So |
#30130 broke this code:
The text was updated successfully, but these errors were encountered: