Issue 3223: add more unsafe scopes
This commit is contained in:
@@ -211,7 +211,7 @@ impl<T: RawBlockTraits> SerialOffsetTable<T> {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe fn build_with(&mut self, value: T) -> usize {
|
unsafe fn build_with(&mut self, value: T) -> usize { unsafe {
|
||||||
let mut ptr;
|
let mut ptr;
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
@@ -228,17 +228,17 @@ impl<T: RawBlockTraits> SerialOffsetTable<T> {
|
|||||||
ptr::write(ptr as *mut T, value);
|
ptr::write(ptr as *mut T, value);
|
||||||
// SAFETY: `ptr` was obtained from `self.block.alloc()`
|
// SAFETY: `ptr` was obtained from `self.block.alloc()`
|
||||||
self.block.get_offset(ptr)
|
self.block.get_offset(ptr)
|
||||||
}
|
}}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
unsafe fn lookup(&self, offset: usize) -> &T {
|
unsafe fn lookup(&self, offset: usize) -> &T { unsafe {
|
||||||
&*self.block.get_unchecked(offset).cast::<T>()
|
&*self.block.get_unchecked(offset).cast::<T>()
|
||||||
}
|
}}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
unsafe fn lookup_mut(&mut self, offset: usize) -> &mut T {
|
unsafe fn lookup_mut(&mut self, offset: usize) -> &mut T { unsafe {
|
||||||
&mut *self.block.get_unchecked(offset).cast::<T>().cast_mut()
|
&mut *self.block.get_unchecked(offset).cast::<T>().cast_mut()
|
||||||
}
|
}}
|
||||||
|
|
||||||
#[allow(clippy::wrong_self_convention)]
|
#[allow(clippy::wrong_self_convention)]
|
||||||
fn to_concurrent(&mut self) -> ConcurrentOffsetTable<T>
|
fn to_concurrent(&mut self) -> ConcurrentOffsetTable<T>
|
||||||
|
|||||||
Reference in New Issue
Block a user