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
|
/// Nem attempt
|
||||||
use core::cell::RefCell;
|
use core::cell::RefCell;
|
||||||
use core::cell::RefMut;
|
|
||||||
|
|
||||||
//use core::borrow::BorrowMut;
|
//use core::borrow::BorrowMut;
|
||||||
/// A resource
|
/// A resource
|
||||||
|
@ -556,17 +555,17 @@ impl<T, CEILING> ResRef<T, C<CEILING>> {
|
||||||
basepri_max::write(<CEILING>::hw());
|
basepri_max::write(<CEILING>::hw());
|
||||||
barrier!();
|
barrier!();
|
||||||
|
|
||||||
let r: &RefCell<T> = &*self.data.get();
|
let a = &*self.data.get();
|
||||||
let rr: RefCell<T> = *r;
|
let mut am = a.borrow_mut();
|
||||||
let mut rm: RefMut<T> = rr.borrow_mut();
|
let ret = f(&mut am, &C { _marker: PhantomData });
|
||||||
let mut t: T = *rm;
|
|
||||||
let ret = f(&mut t, &C { _marker: PhantomData });
|
|
||||||
|
|
||||||
barrier!();
|
barrier!();
|
||||||
basepri::write(old_basepri);
|
basepri::write(old_basepri);
|
||||||
ret
|
ret
|
||||||
} else {
|
} 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