Skip to content

Commit

Permalink
util: add safety comment to assume_init (#4075)
Browse files Browse the repository at this point in the history
  • Loading branch information
Darksonn authored Aug 26, 2021
1 parent 1e2e38b commit 8a097d2
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion tokio/src/util/wake_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,13 @@ pub(crate) struct WakeList {
impl WakeList {
pub(crate) fn new() -> 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,
}
}
Expand Down

0 comments on commit 8a097d2

Please sign in to comment.