mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-14 02:49:40 +00:00
Rollup merge of #131713 - tgross35:stabilize-const_maybe_uninit_write, r=RalfJung,dtolnay
Stabilize `const_maybe_uninit_write` Mark the following API const stable: ```rust impl<T> MaybeUninit<T> { pub const fn write(&mut self, val: T) -> &mut T; } ``` This depends on `const_mut_refs` and [`const_maybe_uninit_assume_init`](https://github.com/rust-lang/rust/issues/86722), both of which have recently been stabilized. Closes: <https://github.com/rust-lang/rust/issues/63567>
This commit is contained in:
commit
e56e68541b
@ -485,9 +485,9 @@ impl<T> MaybeUninit<T> {
|
||||
/// }
|
||||
/// }
|
||||
/// ```
|
||||
#[stable(feature = "maybe_uninit_write", since = "1.55.0")]
|
||||
#[rustc_const_unstable(feature = "const_maybe_uninit_write", issue = "63567")]
|
||||
#[inline(always)]
|
||||
#[stable(feature = "maybe_uninit_write", since = "1.55.0")]
|
||||
#[rustc_const_stable(feature = "const_maybe_uninit_write", since = "CURRENT_RUSTC_VERSION")]
|
||||
pub const fn write(&mut self, val: T) -> &mut T {
|
||||
*self = MaybeUninit::new(val);
|
||||
// SAFETY: We just initialized this value.
|
||||
|
Loading…
Reference in New Issue
Block a user