Skip to content

Commit 77cbee0

Browse files
committed
feat(utils): implement Zeroable for RawCell
1 parent 8750dd0 commit 77cbee0

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/r3_core/src/utils/rawcell.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use core::cell::UnsafeCell;
22

3-
use crate::utils::{Init, ZeroInit};
3+
use crate::utils::{Init, ZeroInit, Zeroable};
44

55
/// Like `UnsafeCell`, but implements `Sync`.
66
#[derive(Debug)]
@@ -29,3 +29,6 @@ impl<T: Init> Init for RawCell<T> {
2929
const INIT: Self = RawCell::new(T::INIT);
3030
}
3131
unsafe impl<T: ZeroInit> ZeroInit for RawCell<T> {}
32+
// FIXME: Derive this when <https://github.com/Lokathor/bytemuck/pull/148> is
33+
// merged
34+
unsafe impl<T: Zeroable> Zeroable for RawCell<T> {}

src/r3_kernel/src/utils/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ mod rawcell;
5656
mod vec;
5757
pub use self::{aligned_storage::*, freeze::*, int::*, prio_bitmap::*, rawcell::*, vec::*};
5858
use r3_core::utils::{AllocError, Allocator, ConstAllocator};
59-
pub use r3_core::utils::{Init, ZeroInit};
59+
pub use r3_core::utils::{Init, ZeroInit, Zeroable};
6060
pub(crate) mod panicking;
6161

6262
/// A "type function" producing a type.

0 commit comments

Comments
 (0)