Skip to content

Incompatibility with master branch of nix crate #123

Closed
@Toasterson

Description

@Toasterson

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions