diff options
author | 2022-02-24 17:31:00 +0000 | |
---|---|---|
committer | 2022-02-24 17:34:32 +0000 | |
commit | db8bea29e61d4659942539f8da7fe4f39c02729f (patch) | |
tree | 183c5108871faa40fe07ee60f8d503f65e004c0a /src/interrupt.rs | |
parent | c39dfb32f2c8a03a2d94c63fb8a9d0771d7c8c82 (diff) | |
download | cortex-m-db8bea29e61d4659942539f8da7fe4f39c02729f.tar.gz cortex-m-db8bea29e61d4659942539f8da7fe4f39c02729f.tar.zst cortex-m-db8bea29e61d4659942539f8da7fe4f39c02729f.zip |
Add a free() method for non-cortex-m build targets that panics, to allow checking code that uses it on native platform.
Diffstat (limited to 'src/interrupt.rs')
-rw-r--r-- | src/interrupt.rs | 12 |
1 files changed, 12 insertions, 0 deletions
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>(_: F) -> R +where + F: FnOnce(&CriticalSection) -> R, +{ + panic!("cortex_m::interrupt::free() is only functional on cortex-m platforms"); +} |