From 5c28130a5f204defe8b43c705fe01d6e58812ea8 Mon Sep 17 00:00:00 2001 From: jotheesh1729 Date: Fri, 4 Sep 2026 16:17:28 -0400 Subject: [PATCH] Fixes #642 Remove redundant non-cortex-m stub for interrupt::free --- cortex-m/CHANGELOG.md | 6 ++++++ cortex-m/src/interrupt.rs | 15 --------------- 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/cortex-m/CHANGELOG.md b/cortex-m/CHANGELOG.md index 873289d7..e8030693 100644 --- a/cortex-m/CHANGELOG.md +++ b/cortex-m/CHANGELOG.md @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## [Unreleased] +### Removed +- The separate `#[cfg(not(cortex_m))]` stub for `interrupt::free`. The real + `free` already compiles on non-Cortex-M targets on its own (it only calls + functions that fall back to `unimplemented!()` off-target), so the stub was + dead weight. + ### Fixed - `NVIC`'s interrupt-bitmap accessors no longer emit a bounds check and a panic path. diff --git a/cortex-m/src/interrupt.rs b/cortex-m/src/interrupt.rs index 2280de36..07da650b 100644 --- a/cortex-m/src/interrupt.rs +++ b/cortex-m/src/interrupt.rs @@ -64,7 +64,6 @@ pub unsafe fn enable() { /// Execute closure `f` in an interrupt-free context. /// /// This as also known as a "critical section". -#[cfg(cortex_m)] #[inline] pub fn free(f: F) -> R where @@ -86,17 +85,3 @@ where r } - -// Make a `free()` function available on hosted platforms to allow checking dependencies without -// specifying a target, but that will panic at runtime if executed. -/// Execute closure `f` in an interrupt-free context. -/// -/// This as also known as a "critical section". -#[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"); -}