diff options
author | 2017-04-08 09:30:57 -0500 | |
---|---|---|
committer | 2017-04-08 09:36:27 -0500 | |
commit | d4dec0124b961bef1f36b7da986b5d47fc9cbe15 (patch) | |
tree | 4f25e69fba4935a5bb5cc4d41ab21ba89278577a /src/interrupt.rs | |
parent | e16816e895c73b15a9808629576df2573d434b9a (diff) | |
download | cortex-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.rs | 8 |
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 |