mirror of
https://github.com/tokio-rs/tokio.git
synced 2025-10-01 12:20:39 +00:00
util: add safety comment to assume_init (#4075)
This commit is contained in:
parent
1e2e38b7cd
commit
8a097d27b5
@ -12,7 +12,13 @@ pub(crate) struct WakeList {
|
|||||||
impl WakeList {
|
impl WakeList {
|
||||||
pub(crate) fn new() -> Self {
|
pub(crate) fn new() -> Self {
|
||||||
Self {
|
Self {
|
||||||
inner: unsafe { MaybeUninit::uninit().assume_init() },
|
inner: unsafe {
|
||||||
|
// safety: Create an uninitialized array of `MaybeUninit`. The
|
||||||
|
// `assume_init` is safe because the type we are claiming to
|
||||||
|
// have initialized here is a bunch of `MaybeUninit`s, which do
|
||||||
|
// not require initialization.
|
||||||
|
MaybeUninit::uninit().assume_init()
|
||||||
|
},
|
||||||
curr: 0,
|
curr: 0,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user