From 1a46345a2aa710c4ec5ea8fb6589424bc4450d0f Mon Sep 17 00:00:00 2001 From: Emil Fresk Date: Sun, 21 Feb 2021 16:15:34 +0100 Subject: Fixed UB in generated `Monotonic::now()` --- macros/src/codegen/timer_queue.rs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'macros/src/codegen/timer_queue.rs') diff --git a/macros/src/codegen/timer_queue.rs b/macros/src/codegen/timer_queue.rs index 54b2c1f0..65560680 100644 --- a/macros/src/codegen/timer_queue.rs +++ b/macros/src/codegen/timer_queue.rs @@ -69,11 +69,11 @@ pub fn codegen(app: &App, analysis: &Analysis, _extra: &Extra) -> Vec); + let mono_ty = quote!(Option<#m>); items.push(quote!( #[doc = #doc] - static mut #mono: #mono_ty = core::mem::MaybeUninit::uninit(); + static mut #mono: #mono_ty = None; )); } @@ -122,10 +122,15 @@ pub fn codegen(app: &App, analysis: &Analysis, _extra: &Extra) -> Vec