aboutsummaryrefslogtreecommitdiff
path: root/src/interrupt.rs
diff options
context:
space:
mode:
authorGravatar Jorge Aparicio <japaricious@gmail.com> 2017-04-08 09:30:57 -0500
committerGravatar Jorge Aparicio <japaricious@gmail.com> 2017-04-08 09:36:27 -0500
commitd4dec0124b961bef1f36b7da986b5d47fc9cbe15 (patch)
tree4f25e69fba4935a5bb5cc4d41ab21ba89278577a /src/interrupt.rs
parente16816e895c73b15a9808629576df2573d434b9a (diff)
downloadcortex-m-d4dec0124b961bef1f36b7da986b5d47fc9cbe15.tar.gz
cortex-m-d4dec0124b961bef1f36b7da986b5d47fc9cbe15.tar.zst
cortex-m-d4dec0124b961bef1f36b7da986b5d47fc9cbe15.zip
remove the Mutex.borrow_mut
because it can be used to bypass Rust's borrow checker ``` rust static FOO: Mutex<bool> = Mutex::new(false); fn main() { cortex_m::interrupt::free(|mut cs1| { cortex_m::interrupt::free(|mut cs2| { let foo = FOO.borrow_mut(&mut cs1); let and_foo = FOO.borrow_mut(&mut cs2); }); }); } ```
Diffstat (limited to 'src/interrupt.rs')
-rw-r--r--src/interrupt.rs8
1 files changed, 0 insertions, 8 deletions
diff --git a/src/interrupt.rs b/src/interrupt.rs
index e11fdc3..a96b845 100644
--- a/src/interrupt.rs
+++ b/src/interrupt.rs
@@ -19,14 +19,6 @@ impl<T> Mutex<T> {
pub fn borrow<'cs>(&self, _ctxt: &'cs CriticalSection) -> &'cs T {
unsafe { &*self.inner.get() }
}
-
- /// Mutably borrows the data for the duration of the critical section
- pub fn borrow_mut<'cs>(
- &self,
- _ctxt: &'cs mut CriticalSection,
- ) -> &'cs mut T {
- unsafe { &mut *self.inner.get() }
- }
}
/// Interrupt number