Skip to content

Regression building std for armv6k-nintendo-3ds #5044

@hyperc4m

Description

@hyperc4m

repro:
rustup default nightly-2026-04-01
cargo new bugtest
cd bugtest
cargo build -Zbuild-std=std --target armv6k-nintendo-3ds

error[E0308]: mismatched types
   --> /Users/hypercam/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/sys/net/connection/socket/unix.rs:180:71
    |
180 |         let mut pollfd = libc::pollfd { fd: self.as_raw_fd(), events: libc::POLLOUT, revents: 0 };
    |                                                                       ^^^^^^^^^^^^^ expected `i32`, found `i16`

error[E0308]: mismatched types
   --> /Users/hypercam/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/sys/net/connection/socket/unix.rs:224:45
    |
224 |                         if pollfd.revents & (libc::POLLHUP | libc::POLLERR) != 0 {
    |                                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `i32`, found `i16`

error[E0277]: no implementation for `i32 & i16`
   --> /Users/hypercam/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/sys/net/connection/socket/unix.rs:224:43
    |
224 |                         if pollfd.revents & (libc::POLLHUP | libc::POLLERR) != 0 {
    |                                           ^ no implementation for `i32 & i16`
    |
    = help: the trait `BitAnd<i16>` is not implemented for `i32`

I believe this to have regressed from this PR cab0c82

Horizon had it's definition for pollfd pulled out to ‎src/unix/newlib/horizon/mod.rs which differs from the definition in unix/mod.rs

   pub struct pollfd {
        pub fd: c_int,
        pub events: c_int,
        pub revents: c_int,
    }

The horizon specific implementation matches the devkitPro/libctru definition of pollfd which to me says the fields are supposed to be i32. https://github.com/devkitPro/libctru/blob/master/libctru/include/poll.h#L12

However the consts POLLIN, POLLOUT, etc definied in horizon/mod.rs are c_short.

pub const POLLIN: c_short = 0x0001;
pub const POLLPRI: c_short = 0x0002;
pub const POLLOUT: c_short = 0x0004;

I believe the fix here is to change the relevant consts in horizon/mod.rs to be c_int.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: bug

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions