From db8bea29e61d4659942539f8da7fe4f39c02729f Mon Sep 17 00:00:00 2001 From: Adam Greig Date: Thu, 24 Feb 2022 17:31:00 +0000 Subject: Add a free() method for non-cortex-m build targets that panics, to allow checking code that uses it on native platform. --- src/interrupt.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/interrupt.rs') diff --git a/src/interrupt.rs b/src/interrupt.rs index 06b91f1..72450c4 100644 --- a/src/interrupt.rs +++ b/src/interrupt.rs @@ -77,3 +77,15 @@ where r } + +// Make a `free()` function available to allow checking dependencies without specifying a target, +// but that will panic at runtime if executed. +#[doc(hidden)] +#[cfg(not(cortex_m))] +#[inline] +pub fn free(_: F) -> R +where + F: FnOnce(&CriticalSection) -> R, +{ + panic!("cortex_m::interrupt::free() is only functional on cortex-m platforms"); +} -- cgit v1.2.3