Skip to content

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

Closed

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

Activity

  1. added
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Jun 9, 2024
  2. veera-sivarajan commented on Jun 9, 2024

    @veera-sivarajan
    Contributor

    @rustbot label -needs-triage +O-hermit +A-cross +T-libs

  3. added
    A-crossArea: Cross compilation
    O-hermitOperating System: Hermit
    T-libsRelevant to the library team, which will review and decide on the PR/issue.
    and removed
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Jun 9, 2024
  4. added a commit that references this issue on Jun 9, 2024
  5. stlankes commented on Jun 12, 2024

    @stlankes
    Contributor

    @Thomasdezeeuw I agree, the std::os::fd module is missing. I will create a PR.

  6. added a commit that references this issue on Jun 14, 2024
  7. added a commit that references this issue on Jun 17, 2024
    cd4c0f0
  8. added a commit that references this issue on Jun 17, 2024
    6237d12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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