{
  "$type": "site.standard.document",
  "bskyPostRef": {
    "cid": "bafyreib4k7uu2wtqjgaupjzxtnvezpv7vq6usuueckotvcjanz5econ5jm",
    "uri": "at://did:plc:ivbknywyskln22er3nkssdhl/app.bsky.feed.post/3mjl46nump352"
  },
  "path": "/t/introduce-box-new-uninit-array-and-box-new-zeroed-array/24179#post_2",
  "publishedAt": "2026-04-15T23:32:22.000Z",
  "site": "https://internals.rust-lang.org",
  "tags": [
    "MaybeUninit::transpose"
  ],
  "textContent": "Because arrays are Sized, we can use the existing `new_uninit`/`new_zeroed` to get the right allocation for this…but I don't see a good way to then reinterpret the MaybeUninit to be elementwise. MaybeUninit::transpose does exist (unstably), but it doesn't apply to Boxed arrays. Still, I think that might be a better missing piece to add, rather than new top-level factory methods.\n\nAnother alternative is `Box::new([MaybeUninit::zeroed(); N])`, but then you're trusting the optimizer to eliminate the intermediate copy. So I see the motivation for _something_ here.",
  "title": "Introduce `Box::new_uninit_array` and `Box::new_zeroed_array`"
}