aboutsummaryrefslogtreecommitdiff
path: root/macros/src/codegen/module.rs
diff options
context:
space:
mode:
authorGravatar Emil Fresk <emil.fresk@gmail.com> 2021-04-08 09:12:08 +0200
committerGravatar Emil Fresk <emil.fresk@gmail.com> 2021-04-08 10:14:14 +0200
commit51500a1d7096395be9162599fae647ec121db91d (patch)
tree17f732cbb06dd480bd0881d0ec627cc173ba5bfc /macros/src/codegen/module.rs
parent2068eae9280881e34b5cc2d76b0b1a61402223e7 (diff)
downloadrtic-51500a1d7096395be9162599fae647ec121db91d.tar.gz
rtic-51500a1d7096395be9162599fae647ec121db91d.tar.zst
rtic-51500a1d7096395be9162599fae647ec121db91d.zip
Fixed UB in `spawn_at`
Diffstat (limited to 'macros/src/codegen/module.rs')
-rw-r--r--macros/src/codegen/module.rs16
1 files changed, 5 insertions, 11 deletions
diff --git a/macros/src/codegen/module.rs b/macros/src/codegen/module.rs
index ac69a803..50146c02 100644
--- a/macros/src/codegen/module.rs
+++ b/macros/src/codegen/module.rs
@@ -414,17 +414,11 @@ pub fn codegen(
let tq = unsafe { &mut *#app_path::#tq.as_mut_ptr() };
- if let Some(mono) = #app_path::#m_ident.as_mut() {
- tq.enqueue_unchecked(
- nr,
- || #enable_interrupt,
- || #pend,
- mono)
- } else {
- // We can only use the timer queue if `init` has returned, and it
- // writes the `Some(monotonic)` we are accessing here.
- core::hint::unreachable_unchecked()
- }
+ tq.enqueue_unchecked(
+ nr,
+ || #enable_interrupt,
+ || #pend,
+ #app_path::#m_ident.as_mut());
Ok(SpawnHandle { marker })
})