Rollup merge of #88492 - est31:maybe_uninit_write, r=wesleywiser
Use MaybeUninit::write in functor.rs MaybeUninit::write is stable as of 1.55.0.
This commit is contained in:
commit
4adacfd43e
1 changed files with 1 additions and 1 deletions
|
@ -26,7 +26,7 @@ impl<T> IdFunctor for Box<T> {
|
|||
// inverse of `Box::assume_init()` and should be safe.
|
||||
let mut raw: Box<mem::MaybeUninit<T>> = Box::from_raw(raw.cast());
|
||||
// SAFETY: Write the mapped value back into the `Box`.
|
||||
ptr::write(raw.as_mut_ptr(), f(value));
|
||||
raw.write(f(value));
|
||||
// SAFETY: We just initialized `raw`.
|
||||
raw.assume_init()
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue