Fix VxWorks available parallelism: Move nonzero::uncheked into unsafe… · patricklam/verify-rust-std@c21ba97 (original) (raw)

Original file line number Diff line number Diff line change
@@ -489,9 +489,11 @@ pub fn available_parallelism() -> io::Result<NonZero> {
489 489 fn vxCpuEnabledGet() -> libc::cpuset_t;
490 490 }
491 491
492 -// always fetches a valid bitmask
493 -let set = unsafe { vxCpuEnabledGet() };
494 -Ok(NonZero::new_unchecked(set.count_ones() as usize))
492 +unsafe{
493 +// always fetches a valid bitmask
494 +let set = vxCpuEnabledGet();
495 +Ok(NonZero::new_unchecked(set.count_ones() as usize))
496 +}
495 497 } else {
496 498 // FIXME: implement on Redox, l4re
497 499 Err(io::const_io_error!(io::ErrorKind::Unsupported, "Getting the number of hardware threads is not supported on the target platform"))