diff options
author | 2021-11-03 08:26:45 +0100 | |
---|---|---|
committer | 2021-11-03 08:26:45 +0100 | |
commit | d3d66c97aef5eeb06ea57dac8200c43f6720e1c1 (patch) | |
tree | a6a7984baba2d96da20c7086dcdb5443264f5027 /macros/src/codegen/post_init.rs | |
parent | 1e2ab78a3fad8f383e5949dd0a11aaaaf03467f1 (diff) | |
download | rtic-d3d66c97aef5eeb06ea57dac8200c43f6720e1c1.tar.gz rtic-d3d66c97aef5eeb06ea57dac8200c43f6720e1c1.tar.zst rtic-d3d66c97aef5eeb06ea57dac8200c43f6720e1c1.zip |
Cleanup of resource initialization, no need to dereference
Diffstat (limited to 'macros/src/codegen/post_init.rs')
-rw-r--r-- | macros/src/codegen/post_init.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/macros/src/codegen/post_init.rs b/macros/src/codegen/post_init.rs index b3359ab4..07fbd03c 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<TokenStream2> { // Resource is a RacyCell<MaybeUninit<T>> // - `get_mut` to obtain a raw pointer to `MaybeUninit<T>` // - `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<TokenStream2> { // Resource is a RacyCell<MaybeUninit<T>> // - `get_mut` to obtain a raw pointer to `MaybeUninit<T>` // - `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)); )); } } |