diff options
author | 2018-04-26 01:52:07 +0200 | |
---|---|---|
committer | 2018-04-26 01:52:07 +0200 | |
commit | bff66f8fa796e305df93f28d9a5e352eb51596e5 (patch) | |
tree | c6878210d90f8e7e8029a36cf8ebf23326c4f592 /src/macros.rs | |
parent | 00d6faae149c062e79a822b8d46b6b5e7e972f57 (diff) | |
download | cortex-m-bff66f8fa796e305df93f28d9a5e352eb51596e5.tar.gz cortex-m-bff66f8fa796e305df93f28d9a5e352eb51596e5.tar.zst cortex-m-bff66f8fa796e305df93f28d9a5e352eb51596e5.zip |
make compilable on stable
Diffstat (limited to 'src/macros.rs')
-rw-r--r-- | src/macros.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/macros.rs b/src/macros.rs index 7d2cf6a..7af64bc 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -50,13 +50,15 @@ macro_rules! iprintln { /// } /// ``` #[macro_export] +// TODO(stable) needs stable const `mem::uninitialized` OR stable const `MaybeUninit::new()` (RFC +// 1892) +#[cfg(feature = "singleton")] macro_rules! singleton { (: $ty:ty = $expr:expr) => { $crate::interrupt::free(|_| { static mut USED: bool = false; static mut VAR: $crate::UntaggedOption<$ty> = $crate::UntaggedOption { none: () }; - #[allow(unsafe_code)] let used = unsafe { USED }; if used { @@ -92,6 +94,7 @@ macro_rules! singleton { /// } /// ``` #[allow(dead_code)] +#[cfg(feature = "singleton")] const CFAIL: () = (); /// ``` @@ -107,4 +110,5 @@ const CFAIL: () = (); /// } /// ``` #[allow(dead_code)] +#[cfg(feature = "singleton")] const CPASS: () = (); |