aboutsummaryrefslogtreecommitdiff
path: root/src/macros.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/macros.rs')
-rw-r--r--src/macros.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/macros.rs b/src/macros.rs
index c9a32c2..c5799bf 100644
--- a/src/macros.rs
+++ b/src/macros.rs
@@ -54,13 +54,14 @@ macro_rules! singleton {
(: $ty:ty = $expr:expr) => {
$crate::interrupt::free(|_| unsafe {
static mut USED: bool = false;
- static mut VAR: $ty = $expr;
+ static mut VAR: $crate::UntaggedOption<$ty> = $crate::UntaggedOption { none: () };
if USED {
None
} else {
USED = true;
- let var: &'static mut _ = &mut VAR;
+ VAR.some = $expr;
+ let var: &'static mut _ = &mut VAR.some;
Some(var)
}
})