Skip to content

Commit 5d362e6

Browse files
committed
time: update comment in zero_init_timespec
1 parent 06bb1be commit 5d362e6

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/sys/time.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@ use std::time::Duration;
99
use std::{cmp, fmt, ops};
1010

1111
const fn zero_init_timespec() -> timespec {
12-
// `std::mem::MaybeUninit::zeroed()` is not yet a const fn
13-
// (https://github.com/rust-lang/rust/issues/91850) so we will instead initialize an array of
14-
// the appropriate size to zero and then transmute it to a timespec value.
12+
// TODO(MSRV>=1.75, feature(const_maybe_uninit_zeroed): use [`std::mem::MaybeUninit::zeroed()`]
1513
unsafe { std::mem::transmute([0u8; std::mem::size_of::<timespec>()]) }
1614
}
1715

@@ -33,7 +31,7 @@ pub(crate) mod timer {
3331
use bitflags::bitflags;
3432

3533
#[derive(Debug, Clone, Copy)]
36-
pub(crate) struct TimerSpec(libc::itimerspec);
34+
pub(crate) struct TimerSpec(MaybeUninit<libc::itimerspec>);
3735

3836
impl TimerSpec {
3937
pub const fn none() -> Self {

0 commit comments

Comments
 (0)