From 403b80d32e4536088e482f8e36e0d2132a6f031a Mon Sep 17 00:00:00 2001 From: est31 Date: Mon, 30 Aug 2021 17:23:08 +0200 Subject: [PATCH] Use MaybeUninit::write in functor.rs MaybeUninit::write is stable as of 1.55.0. --- compiler/rustc_data_structures/src/functor.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/rustc_data_structures/src/functor.rs b/compiler/rustc_data_structures/src/functor.rs index fe7a256d210..5b83ae31247 100644 --- a/compiler/rustc_data_structures/src/functor.rs +++ b/compiler/rustc_data_structures/src/functor.rs @@ -26,7 +26,7 @@ impl IdFunctor for Box { // inverse of `Box::assume_init()` and should be safe. let mut raw: Box> = 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() }