Sync with latest cortex-m version
sbechet opened this issue · 0 comments
sbechet commented
It's not really a bug, but I can't do this synchronization. There is currently something that I did not understand in the functioning of rust
I tried to replace init()
with:
use core::borrow::BorrowMut;
use core::ops::DerefMut;
use cortex_m::interrupt::Mutex;
use linked_list_allocator::Heap;
// ...
pub struct CortexMHeap {
heap: Mutex<Heap>,
}
// ...
pub unsafe fn init(&self, start_addr: usize, size: usize) {
cortex_m::interrupt::free(|cs| {
self.heap
.borrow(cs)
.borrow_mut()
.deref_mut()
.init(start_addr, size);
});
}
}
but answer is:
error[E0596]: cannot borrow data in a `&` reference as mutable
--> src/lib.rs:103:17
|
103 | / self.heap
104 | | .borrow(cs)
105 | | .borrow_mut()
106 | | .deref_mut()
| |________________________________^ cannot borrow as mutable