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

Remove MaybeUninit::uninit_array() and replace it with inline const blocks. #125082

Merged
merged 1 commit into from
Jun 24, 2024

Commits on Jun 24, 2024

  1. Replace MaybeUninit::uninit_array() with array repeat expression.

    This is possible now that inline const blocks are stable; the idea was
    even mentioned as an alternative when `uninit_array()` was added:
    <rust-lang#65580 (comment)>
    
    > if it’s stabilized soon enough maybe it’s not worth having a
    > standard library method that will be replaceable with
    > `let buffer = [MaybeUninit::<T>::uninit(); $N];`
    
    Const array repetition and inline const blocks are now stable (in the
    next release), so that circumstance has come to pass, and we no longer
    have reason to want `uninit_array()` other than convenience. Therefore,
    let’s evaluate the inconvenience by not using `uninit_array()` in
    the standard library, before potentially deleting it entirely.
    kpreid committed Jun 24, 2024
    Configuration menu
    Copy the full SHA
    13fca73 View commit details
    Browse the repository at this point in the history