Skip to content
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

Both the name of and the docs for MaybeUninit::uninit_array() make what it actually does somewhat unclear #66845

Open
slightlyoutofphase opened this issue Nov 28, 2019 · 0 comments · May be fixed by #101179
Labels
A-array Area: [T; N] A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools C-enhancement Category: An issue proposing an enhancement or a PR with one. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.

Comments

@slightlyoutofphase
Copy link
Contributor

slightlyoutofphase commented Nov 28, 2019

Basically, based on the name of the function, and also the part of the docs for it that says:

Create a new array of MaybeUninit<T> items, in an uninitialized state.

I initially had the impression that it internally amounted to:

MaybeUninit::<[MaybeUninit<T>; LEN]>::uninit()

and returned an uninitialized array of uninitialized MaybeUninits.

However, after looking at the source, I realized it actually amounts to:

MaybeUninit::<[MaybeUninit<T>; LEN]>::uninit().assume_init()

and returns an initialized array of uninitialized MaybeUninits (which is what I actually needed, so that's good at least!)

@jonas-schievink jonas-schievink added C-enhancement Category: An issue proposing an enhancement or a PR with one. A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. labels Nov 28, 2019
@SUPERCILEX SUPERCILEX linked a pull request Oct 17, 2022 that will close this issue
@workingjubilee workingjubilee added the A-array Area: [T; N] label Mar 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-array Area: [T; N] A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools C-enhancement Category: An issue proposing an enhancement or a PR with one. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants