Skip to content

Commit

Permalink
Unrolled build for rust-lang#131713
Browse files Browse the repository at this point in the history
Rollup merge of rust-lang#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`](rust-lang#86722), both of which have recently been stabilized.

Closes: <rust-lang#63567>
  • Loading branch information
rust-timer authored Dec 3, 2024
2 parents 42b4b9c + c5fedc2 commit d9f3089
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions library/core/src/mem/maybe_uninit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit d9f3089

Please sign in to comment.