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

Incompatibility with master branch of nix crate #123

Open
Toasterson opened this issue Dec 28, 2024 · 1 comment · May be fixed by #124
Open

Incompatibility with master branch of nix crate #123

Toasterson opened this issue Dec 28, 2024 · 1 comment · May be fixed by #124

Comments

@Toasterson
Copy link

Toasterson commented Dec 28, 2024

Hello,

Due to porting reasons I needed to overwrite the nix crate in the rust compiler to the master branch so that it has the proper Signal list available for our OS (illumos, Solaris). Looks like there is a braking change coming down the pipe though.

error[E0277]: the trait bound `i32: AsFd` is not satisfied
   --> /ws/klausz/.cargo/git/checkouts/rust-ctrlc-275af04921a7779b/3502f44/src/platform/unix/mod.rs:108:34
    |
108 |     if let Err(e) = fcntl::fcntl(PIPE.1, fcntl::FcntlArg::F_SETFL(fcntl::OFlag::O_NONBLOCK)) {
    |                     ------------ ^^^^^^ the trait `AsFd` is not implemented for `i32`
    |                     |
    |                     required by a bound introduced by this call
    |
    = help: the following other types implement trait `AsFd`:
              &T
              &mut T
              Arc<T>
              BorrowedFd<'_>
              Box<T>
              ChildStderr
              ChildStdin
              ChildStdout
            and 22 others
note: required by a bound in `nix::fcntl::fcntl`
   --> /ws/klausz/.cargo/git/checkouts/nix-db0be66aec5a83e2/e789a7c/src/fcntl.rs:861:18
    |
861 | pub fn fcntl<Fd: std::os::fd::AsFd>(fd: Fd, arg: FcntlArg) -> Result<c_int> {
    |                  ^^^^^^^^^^^^^^^^^ required by this bound in `fcntl`

error[E0277]: the trait bound `i32: AsFd` is not satisfied
    --> /ws/klausz/.cargo/git/checkouts/rust-ctrlc-275af04921a7779b/3502f44/src/platform/unix/mod.rs:182:28
     |
182  |         match unistd::read(PIPE.0, &mut buf[..]) {
     |               ------------ ^^^^^^ the trait `AsFd` is not implemented for `i32`
     |               |
     |               required by a bound introduced by this call
     |
     = help: the following other types implement trait `AsFd`:
               &T
               &mut T
               Arc<T>
               BorrowedFd<'_>
               Box<T>
               ChildStderr
               ChildStdin
               ChildStdout
             and 22 others
note: required by a bound in `nix::unistd::read`
    --> /ws/klausz/.cargo/git/checkouts/nix-db0be66aec5a83e2/e789a7c/src/unistd.rs:1353:17
     |
1353 | pub fn read<Fd: std::os::fd::AsFd>(fd: Fd, buf: &mut [u8]) -> Result<usize> {
     |                 ^^^^^^^^^^^^^^^^^ required by this bound in `read`

For more information about this error, try `rustc --explain E0277`.
error: could not compile `ctrlc` (lib) due to 2 previous errors

Do you have an idea how to fix this? I am happy to carry a fix in a fork for compiling rustc only. As alternative I can also try to go back to the last nix crate release and try backporting the patch we need for signals into there.

Any insight how you want to move forward with this breaking change helps. Thanks

@Detegr
Copy link
Owner

Detegr commented Jan 2, 2025

I guess the RawFd types should be changed to use a type that has AsFd trait implemented. That would be OwnedFd or BorrowedFd in this crate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants