Skip to content

Commit 9263be6

Browse files
committed
feat(core)!: remove r3_core::utils::ZeroInit
1 parent 430dd38 commit 9263be6

File tree

8 files changed

+9
-114
lines changed

8 files changed

+9
-114
lines changed

src/r3/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ pub use r3_core::{bag, hunk, kernel, time};
6262
///
6363
/// [1]: r3_core#stability
6464
pub mod utils {
65-
pub use r3_core::utils::{Init, ZeroInit, Zeroable, ZeroableInOption};
65+
pub use r3_core::utils::{Init, Zeroable, ZeroableInOption};
6666
}
6767

6868
/// The prelude module.

src/r3_core/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1616
- `r3_core::utils::{Zeroable,ZeroableInOption}` (re-exported from `bytemuck ^1`)
1717
- Implement `Zeroable` on `r3_core::time::{Duration, Time}`
1818

19+
### Removed
20+
21+
- **Breaking:** `r3_core::utils::ZeroInit` (superseded by `Zeroable`)
22+
1923
## [0.1.4] - 2022-11-16
2024

2125
### Changed

src/r3_core/src/time/duration.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use core::{fmt, ops};
22

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

55
/// Represents a signed time span used by the API surface of R3-OS.
66
///
@@ -16,10 +16,6 @@ impl Init for Duration {
1616
const INIT: Self = Self::ZERO;
1717
}
1818

19-
// Safety: `Duration` is `repr(transparent)` and the only inner field is `i32`,
20-
// which is `ZeroInit`
21-
unsafe impl ZeroInit for Duration {}
22-
2319
impl Default for Duration {
2420
fn default() -> Self {
2521
Self::INIT

src/r3_core/src/time/time.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use core::{fmt, ops};
22

33
use crate::{
44
time::Duration,
5-
utils::{Init, ZeroInit, Zeroable},
5+
utils::{Init, Zeroable},
66
};
77

88
/// Represents a timestamp used by the API surface of R3-OS.
@@ -23,10 +23,6 @@ impl Init for Time {
2323
const INIT: Self = Self::ZERO;
2424
}
2525

26-
// Safety: `Time` is `repr(transparent)` and the only inner field is `u64`,
27-
// which is `ZeroInit`
28-
unsafe impl ZeroInit for Time {}
29-
3026
impl Default for Time {
3127
fn default() -> Self {
3228
Self::INIT

src/r3_core/src/utils/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,9 @@ mod init;
7474
pub mod mem;
7575
mod rawcell;
7676
pub(crate) mod refcell;
77-
mod zeroinit;
7877
pub use aligned_storage::*;
7978
pub use init::*;
8079
pub use rawcell::*;
81-
pub use zeroinit::*;
8280

8381
pub use bytemuck::{Zeroable, ZeroableInOption};
8482

src/r3_core/src/utils/rawcell.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use core::cell::UnsafeCell;
22

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

55
/// Like `UnsafeCell`, but implements `Sync`.
66
#[derive(Debug)]
@@ -28,7 +28,6 @@ impl<T: ?Sized> RawCell<T> {
2828
impl<T: Init> Init for RawCell<T> {
2929
const INIT: Self = RawCell::new(T::INIT);
3030
}
31-
unsafe impl<T: ZeroInit> ZeroInit for RawCell<T> {}
3231
// FIXME: Derive this when <https://github.com/Lokathor/bytemuck/pull/148> is
3332
// merged
3433
unsafe impl<T: Zeroable> Zeroable for RawCell<T> {}

src/r3_core/src/utils/zeroinit.rs

Lines changed: 0 additions & 98 deletions
This file was deleted.

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, Zeroable};
59+
pub use r3_core::utils::{Init, Zeroable};
6060
pub(crate) mod panicking;
6161

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

0 commit comments

Comments
 (0)