From f846f116fdcf70f6e340a5cef42c6233e31cdc7f Mon Sep 17 00:00:00 2001 From: Gustaf Oxenstierna Date: Sat, 8 Aug 2026 13:50:34 +0000 Subject: [PATCH] fix: build-std on 32 bit arm with 64 bit time * fix: build-std on 32 bit arm with 64 bit time The libc crate has support for building with 64 bit time on 32 bit platforms using the `RUST_LIBC_UNSTABLE_GNU_TIME_BITS` environment variable. Convert the tv_usec field to i64 via `into` in this case since `suseconds_t` is still defined as an i32 when this environment variable is set. * Use placeholder as target type This allows us to rely on the compiler to infer the correct target type, mirroring the approach used in `sys/net/connection/socket/solid.rs`. --- library/std/src/sys/net/connection/socket/unix.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/library/std/src/sys/net/connection/socket/unix.rs b/library/std/src/sys/net/connection/socket/unix.rs index 41850574c96fa..9a35565a799cc 100644 --- a/library/std/src/sys/net/connection/socket/unix.rs +++ b/library/std/src/sys/net/connection/socket/unix.rs @@ -396,10 +396,7 @@ impl Socket { } else { dur.as_secs() as libc::time_t }; - let mut timeout = libc::timeval { - tv_sec: secs, - tv_usec: dur.subsec_micros() as libc::suseconds_t, - }; + let mut timeout = libc::timeval { tv_sec: secs, tv_usec: dur.subsec_micros() as _ }; if timeout.tv_sec == 0 && timeout.tv_usec == 0 { timeout.tv_usec = 1; }