mirror of
https://github.com/rtic-rs/rtic.git
synced 2025-12-19 06:15:45 +01:00
fix memory safety hole around borrow
This commit is contained in:
parent
692ad81ad8
commit
2fb00c7d85
3 changed files with 25 additions and 27 deletions
|
|
@ -64,12 +64,15 @@ where
|
|||
/// section
|
||||
///
|
||||
/// This operation is zero cost and doesn't impose any additional blocking
|
||||
pub fn borrow<'cs, SCEILING>(
|
||||
pub fn borrow<'cs, PRIORITY, SCEILING>(
|
||||
&'static self,
|
||||
_priority: &P<PRIORITY>,
|
||||
_system_ceiling: &'cs C<SCEILING>,
|
||||
) -> &'cs T
|
||||
where
|
||||
SCEILING: GreaterThanOrEqual<CEILING>,
|
||||
CEILING: GreaterThanOrEqual<PRIORITY>,
|
||||
P<PRIORITY>: Priority,
|
||||
{
|
||||
unsafe { &*self.data.get() }
|
||||
}
|
||||
|
|
@ -216,12 +219,14 @@ where
|
|||
C<CEILING>: Ceiling,
|
||||
{
|
||||
/// See [Resource.borrow](./struct.Resource.html#method.borrow)
|
||||
pub fn borrow<'cs, SCEILING>(
|
||||
pub fn borrow<'cs, PRIORITY, SCEILING>(
|
||||
&'static self,
|
||||
_priority: &P<PRIORITY>,
|
||||
_system_ceiling: &'cs C<SCEILING>,
|
||||
) -> &'cs Periph
|
||||
where
|
||||
SCEILING: GreaterThanOrEqual<CEILING>,
|
||||
CEILING: GreaterThanOrEqual<PRIORITY>,
|
||||
{
|
||||
unsafe { &*self.peripheral.get() }
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue