Skip to content

Commit db8bea2

Browse files
committed
Add a free() method for non-cortex-m build targets that panics, to allow checking code that uses it on native platform.
1 parent c39dfb3 commit db8bea2

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

src/interrupt.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,3 +77,15 @@ where
7777

7878
r
7979
}
80+
81+
// Make a `free()` function available to allow checking dependencies without specifying a target,
82+
// but that will panic at runtime if executed.
83+
#[doc(hidden)]
84+
#[cfg(not(cortex_m))]
85+
#[inline]
86+
pub fn free<F, R>(_: F) -> R
87+
where
88+
F: FnOnce(&CriticalSection) -> R,
89+
{
90+
panic!("cortex_m::interrupt::free() is only functional on cortex-m platforms");
91+
}

src/peripheral/tpiu.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,6 @@ impl TPIU {
118118
/// [`trace_output_protocol`](Self::set_trace_output_protocol).
119119
#[inline]
120120
pub fn trace_output_protocol(&self) -> Option<TraceProtocol> {
121-
use core::convert::TryInto;
122121
self.sppr.read().txmode().try_into().ok()
123122
}
124123

0 commit comments

Comments
 (0)