Add Default support for arrays of all sizes #153
Labels
ACP-accepted
API Change Proposal is accepted (seconded with no objections)
api-change-proposal
A proposal to add or alter unstable APIs in the standard libraries
T-libs-api
Proposal
Problem statement
Arrays over the size of 32 do not support
Default
.Motivation, use-cases
let arr = <[u8; 64]>::default();
Solution sketches
[T::default(); N]
This does not work because default only gets called once.
If for some reason an implementation of default is like a generator, this will not behave as expected since the whole array will be the same value rather than being the generated value.
Links and related work
rust-lang/rust#106145
What happens now?
This issue is part of the libs-api team API change proposal process. Once this issue is filed the libs-api team will review open proposals in its weekly meeting. You should receive feedback within a week or two.
The text was updated successfully, but these errors were encountered: