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

Stabilize const_maybe_uninit_zeroed and const_mem_zeroed #116218

Merged
merged 2 commits into from
Nov 5, 2023

Commits on Nov 4, 2023

  1. Stabilize const_maybe_uninit_zeroed

    Make `MaybeUninit::zeroed` const stable. Newly stable API:
    
        // core::mem
        impl<T> MaybeUninit<T> {
            pub const fn zeroed() -> MaybeUninit<T>;
        }
    
    Use of `const_mut_refs` should be acceptable since we do not leak the
    mutability.
    
    Tracking issue: rust-lang#91850
    tgross35 committed Nov 4, 2023
    Configuration menu
    Copy the full SHA
    f6ce646 View commit details
    Browse the repository at this point in the history
  2. Stabilize const_mem_zeroed

    Make `core::mem::zeroed` const stable. Newly stable API:
    
        // core::mem
        pub const unsafe fn zeroed<T>() -> T;
    
    This is stabilized with `const_maybe_uninit_zeroed` since it is a simple
    wrapper.
    
    In order to make this possible, intrinsics `assert_zero_valid` was made
    const stable under `const_assert_type2`.
    `assert_mem_uninitialized_valid` was also made const stable since it is
    under the same gate.
    tgross35 committed Nov 4, 2023
    Configuration menu
    Copy the full SHA
    5e5f334 View commit details
    Browse the repository at this point in the history