diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2024-12-02 23:08:52 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-12-02 23:08:52 +0100 |
| commit | e56e68541b64d3f2c212d2cb4fcb81f23a375eee (patch) | |
| tree | 3d1f2ae228b18525cb186d4a0c6ac96726b12e28 | |
| parent | d49be02cf6d2e2a01264fcdef1e20c826710c0f5 (diff) | |
| parent | c5fedc2267838ab9db5a98f946873685ae69097f (diff) | |
| download | rust-e56e68541b64d3f2c212d2cb4fcb81f23a375eee.tar.gz rust-e56e68541b64d3f2c212d2cb4fcb81f23a375eee.zip | |
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>
| -rw-r--r-- | library/core/src/mem/maybe_uninit.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/library/core/src/mem/maybe_uninit.rs b/library/core/src/mem/maybe_uninit.rs index 3c1a098374e..9b3d6902098 100644 --- a/library/core/src/mem/maybe_uninit.rs +++ b/library/core/src/mem/maybe_uninit.rs @@ -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. |
