diff options
Diffstat (limited to 'compiler/rustc_data_structures/src')
| -rw-r--r-- | compiler/rustc_data_structures/src/functor.rs | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/compiler/rustc_data_structures/src/functor.rs b/compiler/rustc_data_structures/src/functor.rs index 920f7b1ed0a..2703af97a1b 100644 --- a/compiler/rustc_data_structures/src/functor.rs +++ b/compiler/rustc_data_structures/src/functor.rs @@ -31,11 +31,9 @@ impl<T> IdFunctor for Box<T> { let value = raw.read(); // SAFETY: Converts `Box<T>` to `Box<MaybeUninit<T>>` which is the // inverse of `Box::assume_init()` and should be safe. - let mut raw: Box<mem::MaybeUninit<T>> = Box::from_raw(raw.cast()); + let raw: Box<mem::MaybeUninit<T>> = Box::from_raw(raw.cast()); // SAFETY: Write the mapped value back into the `Box`. - raw.write(f(value)?); - // SAFETY: We just initialized `raw`. - raw.assume_init() + Box::write(raw, f(value)?) }) } } |
