Skip to content

Commit 1871ea5

Browse files
committed
fix build.
1 parent 4b84df9 commit 1871ea5

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

library/std/src/sys/pal/unix/thread.rs

+3-5
Original file line numberDiff line numberDiff line change
@@ -355,8 +355,6 @@ pub fn available_parallelism() -> io::Result<NonZero<usize>> {
355355
target_os = "tvos",
356356
target_os = "linux",
357357
target_os = "macos",
358-
target_os = "solaris",
359-
target_os = "illumos",
360358
target_os = "aix",
361359
))] {
362360
#[allow(unused_assignments)]
@@ -485,10 +483,10 @@ pub fn available_parallelism() -> io::Result<NonZero<usize>> {
485483
}
486484
} else if #[cfg(any(target_os = "solaris", target_os = "illumos"))] {
487485
let mut cpus = 0u32;
488-
if unsafe { libc::pset_info(libc::PS_MYID, core::ptr::null_mut(), &mut cpus, core::ptr::null_mut()) } == 0 {
489-
NonZero::new(cpus as usize)
490-
.ok_or(io::const_io_error!(io::ErrorKind::NotFound, "The number of hardware threads is not known for the target platform"))
486+
if unsafe { libc::pset_info(libc::PS_MYID, core::ptr::null_mut(), &mut cpus, core::ptr::null_mut()) } != 0 {
487+
return Err(io::const_io_error!(io::ErrorKind::NotFound, "The number of hardware threads is not known for the target platform"));
491488
}
489+
Ok(unsafe { NonZero::new_unchecked(cpus as usize) })
492490
} else if #[cfg(target_os = "haiku")] {
493491
// system_info cpu_count field gets the static data set at boot time with `smp_set_num_cpus`
494492
// `get_system_info` calls then `smp_get_num_cpus`

0 commit comments

Comments
 (0)