Skip to content

std::os::fd module missing on Hermit #126198

Closed
@Thomasdezeeuw

Description

@Thomasdezeeuw

I tried this code:

use std::os::fd::{AsFd, AsRawFd, BorrowedFd, FromRawFd, IntoRawFd, RawFd};

With --target x86_64-unknown-hermit.

I expected to see this happen: code to compile

Instead, this happened: failed to compile with

error[E0432]: unresolved import `std::os::fd`
   --> src/net/udp.rs:12:14
    |
12  | use std::os::fd::{AsFd, AsRawFd, BorrowedFd, FromRawFd, IntoRawFd, RawFd};
    |              ^^ could not find `fd` in `os`

Looking at the relevant code:

#[cfg(any(unix, target_os = "wasi", doc))]
pub mod fd;

It seems hermit is imply missed from the cfg. Inside of the fd module there is already code for hermit:

#[cfg(target_os = "hermit")]
use hermit_abi as libc;
/// Raw file descriptors.
#[rustc_allowed_through_unstable_modules]
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg(not(target_os = "hermit"))]
pub type RawFd = raw::c_int;
#[rustc_allowed_through_unstable_modules]
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg(target_os = "hermit")]
pub type RawFd = i32;

I think this is just an oversight, but I since I don't develop for Hermit I'm not sure. (I hit this while updating Mio)

/cc @stlankes

Meta

rustc --version --verbose:

rustc 1.81.0-nightly (f21554f7f 2024-06-08)
binary: rustc
commit-hash: f21554f7f0ff447b803961c51acafde04553c1ed
commit-date: 2024-06-08
host: x86_64-unknown-linux-gnu
release: 1.81.0-nightly
LLVM version: 18.1.7

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-crossArea: Cross compilationC-bugCategory: This is a bug.O-hermitOperating System: HermitT-libsRelevant to the library team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions