Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
Thomasdezeeuw opened this issue Jun 9, 2024 · 2 comments · Fixed by #126346
Closed

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

Thomasdezeeuw opened this issue Jun 9, 2024 · 2 comments · Fixed by #126346
Labels
A-cross Area: Cross compilation C-bug Category: This is a bug. O-hermit Operating System: Hermit T-libs Relevant to the library team, which will review and decide on the PR/issue.

Comments

@Thomasdezeeuw
Copy link
Contributor

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
@Thomasdezeeuw Thomasdezeeuw added the C-bug Category: This is a bug. label Jun 9, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jun 9, 2024
@veera-sivarajan
Copy link
Contributor

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

@rustbot rustbot added A-cross Area: Cross compilation O-hermit Operating System: Hermit T-libs Relevant to the library team, which will review and decide on the PR/issue. and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Jun 9, 2024
Thomasdezeeuw added a commit to tokio-rs/mio that referenced this issue Jun 9, 2024
For some reason the `std::os::fd` module is not available on Hermit. It
seems like an oversight and I've opened
rust-lang/rust#126198 to track a fix.
@stlankes
Copy link
Contributor

stlankes commented Jun 12, 2024

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

Thomasdezeeuw added a commit to tokio-rs/mio that referenced this issue Jun 14, 2024
For some reason the `std::os::fd` module is not available on Hermit. It
seems like an oversight and I've opened
rust-lang/rust#126198 to track a fix.
@bors bors closed this as completed in cd4c0f0 Jun 17, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Jun 17, 2024
Rollup merge of rust-lang#126346 - hermit-os:fd, r=Amanieu

export std::os::fd module on HermitOS

The HermitOS' IO interface is similiar to Unix. Consequently, this PR synchronize the FD implementation between both.

closes rust-lang#126198
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-cross Area: Cross compilation C-bug Category: This is a bug. O-hermit Operating System: Hermit T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants