diff --git a/std/src/sys/pal/unix/thread.rs b/std/src/sys/pal/unix/thread.rs index 6f17c73908dad..0fa610eebb4ef 100644 --- a/std/src/sys/pal/unix/thread.rs +++ b/std/src/sys/pal/unix/thread.rs @@ -477,8 +477,8 @@ pub fn available_parallelism() -> io::Result> { fn vxCpuEnabledGet() -> libc::cpuset_t; } + // SAFETY: `vxCpuEnabledGet` always fetches a mask with at least one bit set unsafe{ - // always fetches a valid bitmask let set = vxCpuEnabledGet(); Ok(NonZero::new_unchecked(set.count_ones() as usize)) }