From 5c28130a5f204defe8b43c705fe01d6e58812ea8 Mon Sep 17 00:00:00 2001 From: jotheesh1729 Date: Fri, 4 Sep 2026 16:17:28 -0400 Subject: [PATCH 1/2] 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"); -} From bfacf434ad707c8f3bce2bd5d7d09bab107d06ee Mon Sep 17 00:00:00 2001 From: Jotheesh Kummathi <66893484+jotheesh1729@users.noreply.github.com> Date: Mon, 7 Sep 2026 11:43:01 -0400 Subject: [PATCH 2/2] Remove unused `interrupt::free` stub for non-Cortex-M Removed the dead weight of the separate stub for `interrupt::free` on non-Cortex-M targets. --- cortex-m/CHANGELOG.md | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/cortex-m/CHANGELOG.md b/cortex-m/CHANGELOG.md index e8030693..45fd2aac 100644 --- a/cortex-m/CHANGELOG.md +++ b/cortex-m/CHANGELOG.md @@ -8,10 +8,7 @@ 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. +- The separate `#[cfg(not(cortex_m))]` stub for `interrupt::free`. ### Fixed - `NVIC`'s interrupt-bitmap accessors no longer emit a bounds check and a panic