From c69ff66f4c1d353be5d683ca8c131a04e997e4ed Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Sat, 15 Dec 2018 15:37:20 +0100 Subject: static mut transform: forward `#[cfg]` --- cortex-m-rt/examples/cfg-static.rs | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 cortex-m-rt/examples/cfg-static.rs (limited to 'cortex-m-rt/examples/cfg-static.rs') diff --git a/cortex-m-rt/examples/cfg-static.rs b/cortex-m-rt/examples/cfg-static.rs new file mode 100644 index 0000000..2ffee13 --- /dev/null +++ b/cortex-m-rt/examples/cfg-static.rs @@ -0,0 +1,25 @@ +//! using `#[cfg]` on `static` shouldn't cause compile errors + +#![deny(unsafe_code)] +#![deny(warnings)] +#![no_main] +#![no_std] + +extern crate cortex_m_rt as rt; +extern crate panic_halt; + +use rt::{entry, exception}; + +#[entry] +fn main() -> ! { + #[cfg(never)] + static mut COUNT: u32 = 0; + + loop {} +} + +#[exception] +fn SysTick() { + #[cfg(never)] + static mut FOO: u32 = 0; +} -- cgit v1.2.3