mirror of
https://github.com/rtic-rs/rtic.git
synced 2024-11-25 21:19:35 +01:00
claim_mut with Rust borrow check
This commit is contained in:
parent
9ede9215c2
commit
8547ef73f3
1 changed files with 6 additions and 7 deletions
13
src/lib.rs
13
src/lib.rs
|
@ -434,7 +434,6 @@ where
|
|||
|
||||
/// Nem attempt
|
||||
use core::cell::RefCell;
|
||||
use core::cell::RefMut;
|
||||
|
||||
//use core::borrow::BorrowMut;
|
||||
/// A resource
|
||||
|
@ -556,17 +555,17 @@ impl<T, CEILING> ResRef<T, C<CEILING>> {
|
|||
basepri_max::write(<CEILING>::hw());
|
||||
barrier!();
|
||||
|
||||
let r: &RefCell<T> = &*self.data.get();
|
||||
let rr: RefCell<T> = *r;
|
||||
let mut rm: RefMut<T> = rr.borrow_mut();
|
||||
let mut t: T = *rm;
|
||||
let ret = f(&mut t, &C { _marker: PhantomData });
|
||||
let a = &*self.data.get();
|
||||
let mut am = a.borrow_mut();
|
||||
let ret = f(&mut am, &C { _marker: PhantomData });
|
||||
|
||||
barrier!();
|
||||
basepri::write(old_basepri);
|
||||
ret
|
||||
} else {
|
||||
panic!("");
|
||||
let a = &*self.data.get();
|
||||
let mut am = a.borrow_mut();
|
||||
f(&mut am, &C { _marker: PhantomData })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue