Skip to content

Commit 206c219

Browse files
committed
library/std: Fix build for NetBSD targets with 32-bit c_long
This fixes building `std` for targets like `mipsel-unknown-netbsd`. If `c_long` is an `i64`, this conversion works with `Into`. But if it's an `i32`, this failed to convert a `u32` to an `i32`.
1 parent 22d5776 commit 206c219

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Diff for: std/src/sys/pal/unix/thread_parking.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
use crate::ffi::{c_int, c_void};
66
use crate::ptr;
77
use crate::time::Duration;
8-
use libc::{_lwp_self, clockid_t, lwpid_t, time_t, timespec, CLOCK_MONOTONIC};
8+
use libc::{_lwp_self, c_long, clockid_t, lwpid_t, time_t, timespec, CLOCK_MONOTONIC};
99

1010
extern "C" {
1111
fn ___lwp_park60(
@@ -38,7 +38,7 @@ pub fn park_timeout(dur: Duration, hint: usize) {
3838
// Saturate so that the operation will definitely time out
3939
// (even if it is after the heat death of the universe).
4040
tv_sec: dur.as_secs().try_into().ok().unwrap_or(time_t::MAX),
41-
tv_nsec: dur.subsec_nanos().into(),
41+
tv_nsec: dur.subsec_nanos() as c_long,
4242
};
4343

4444
// Timeout needs to be mutable since it is modified on NetBSD 9.0 and

0 commit comments

Comments
 (0)