aboutsummaryrefslogtreecommitdiff
path: root/macros/src/codegen/post_init.rs
diff options
context:
space:
mode:
Diffstat (limited to 'macros/src/codegen/post_init.rs')
-rw-r--r--macros/src/codegen/post_init.rs12
1 files changed, 5 insertions, 7 deletions
diff --git a/macros/src/codegen/post_init.rs b/macros/src/codegen/post_init.rs
index 5624b20a..b3359ab4 100644
--- a/macros/src/codegen/post_init.rs
+++ b/macros/src/codegen/post_init.rs
@@ -19,10 +19,9 @@ pub fn codegen(app: &App, analysis: &Analysis) -> Vec<TokenStream2> {
// We include the cfgs
#(#cfgs)*
// Resource is a RacyCell<MaybeUninit<T>>
- // - `get_mut_unchecked` to obtain `MaybeUninit<T>`
- // - `as_mut_ptr` to obtain a raw pointer to `MaybeUninit<T>`
+ // - `get_mut` to obtain a raw pointer to `MaybeUninit<T>`
// - `write` the defined value for the late resource T
- #mangled_name.get_mut_unchecked().as_mut_ptr().write(shared_resources.#name);
+ (&mut *#mangled_name.get_mut()).as_mut_ptr().write(shared_resources.#name);
));
}
}
@@ -37,10 +36,9 @@ pub fn codegen(app: &App, analysis: &Analysis) -> Vec<TokenStream2> {
// We include the cfgs
#(#cfgs)*
// Resource is a RacyCell<MaybeUninit<T>>
- // - `get_mut_unchecked` to obtain `MaybeUninit<T>`
- // - `as_mut_ptr` to obtain a raw pointer to `MaybeUninit<T>`
+ // - `get_mut` to obtain a raw pointer to `MaybeUninit<T>`
// - `write` the defined value for the late resource T
- #mangled_name.get_mut_unchecked().as_mut_ptr().write(local_resources.#name);
+ (&mut *#mangled_name.get_mut()).as_mut_ptr().write(local_resources.#name);
));
}
}
@@ -58,7 +56,7 @@ pub fn codegen(app: &App, analysis: &Analysis) -> Vec<TokenStream2> {
// Store the monotonic
let name = util::monotonic_ident(&monotonic.to_string());
- stmts.push(quote!(*#name.get_mut_unchecked() = Some(monotonics.#idx);));
+ stmts.push(quote!(#name.get_mut().write(Some(monotonics.#idx));));
}
// Enable the interrupts -- this completes the `init`-ialization phase