diff --git a/macros/src/codegen/post_init.rs b/macros/src/codegen/post_init.rs index b3359ab468..07fbd03c9c 100644 --- a/macros/src/codegen/post_init.rs +++ b/macros/src/codegen/post_init.rs @@ -21,7 +21,7 @@ pub fn codegen(app: &App, analysis: &Analysis) -> Vec { // Resource is a RacyCell> // - `get_mut` to obtain a raw pointer to `MaybeUninit` // - `write` the defined value for the late resource T - (&mut *#mangled_name.get_mut()).as_mut_ptr().write(shared_resources.#name); + #mangled_name.get_mut().write(core::mem::MaybeUninit::new(shared_resources.#name)); )); } } @@ -38,7 +38,7 @@ pub fn codegen(app: &App, analysis: &Analysis) -> Vec { // Resource is a RacyCell> // - `get_mut` to obtain a raw pointer to `MaybeUninit` // - `write` the defined value for the late resource T - (&mut *#mangled_name.get_mut()).as_mut_ptr().write(local_resources.#name); + #mangled_name.get_mut().write(core::mem::MaybeUninit::new(local_resources.#name)); )); } }