Skip to content

ctrlc compile error for versions beyond 2.0.0-rc.3 #609

Closed
@apollolabsdev

Description

@apollolabsdev

Trying to install espflash for any release beyond 2.0.0-rc.3 is generating several errors (shown below) when compiling ctrlc.

error[E0308]: mismatched types
   --> /Users/omarhiari/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ctrlc-3.4.3/src/platform/unix/mod.rs:50:33
    |
50  |             .and_then(|_| fcntl(pipe.0, FcntlArg::F_SETFD(FdFlag::FD_CLOEXEC)))
    |                           ----- ^^^^^^ expected `i32`, found `OwnedFd`
    |                           |
    |                           arguments to this function are incorrect
    |
note: function defined here
   --> /Users/omarhiari/.cargo/registry/src/index.crates.io-6f17d22bba15001f/nix-0.28.0/src/fcntl.rs:600:8
    |
600 | pub fn fcntl(fd: RawFd, arg: FcntlArg) -> Result<c_int> {
    |        ^^^^^

error[E0308]: mismatched types
   --> /Users/omarhiari/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ctrlc-3.4.3/src/platform/unix/mod.rs:51:33
    |
51  |             .and_then(|_| fcntl(pipe.1, FcntlArg::F_SETFD(FdFlag::FD_CLOEXEC)));
    |                           ----- ^^^^^^ expected `i32`, found `OwnedFd`
    |                           |
    |                           arguments to this function are incorrect
    |
note: function defined here
   --> /Users/omarhiari/.cargo/registry/src/index.crates.io-6f17d22bba15001f/nix-0.28.0/src/fcntl.rs:600:8
    |
600 | pub fn fcntl(fd: RawFd, arg: FcntlArg) -> Result<c_int> {
    |        ^^^^^

error[E0308]: mismatched types
   --> /Users/omarhiari/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ctrlc-3.4.3/src/platform/unix/mod.rs:56:33
    |
56  |             .and_then(|_| fcntl(pipe.0, FcntlArg::F_SETFL(OFlag::O_NONBLOCK)))
    |                           ----- ^^^^^^ expected `i32`, found `OwnedFd`
    |                           |
    |                           arguments to this function are incorrect
    |
note: function defined here
   --> /Users/omarhiari/.cargo/registry/src/index.crates.io-6f17d22bba15001f/nix-0.28.0/src/fcntl.rs:600:8
    |
600 | pub fn fcntl(fd: RawFd, arg: FcntlArg) -> Result<c_int> {
    |        ^^^^^

error[E0308]: mismatched types
   --> /Users/omarhiari/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ctrlc-3.4.3/src/platform/unix/mod.rs:57:33
    |
57  |             .and_then(|_| fcntl(pipe.1, FcntlArg::F_SETFL(OFlag::O_NONBLOCK)));
    |                           ----- ^^^^^^ expected `i32`, found `OwnedFd`
    |                           |
    |                           arguments to this function are incorrect
    |
note: function defined here
   --> /Users/omarhiari/.cargo/registry/src/index.crates.io-6f17d22bba15001f/nix-0.28.0/src/fcntl.rs:600:8
    |
600 | pub fn fcntl(fd: RawFd, arg: FcntlArg) -> Result<c_int> {
    |        ^^^^^

error[E0308]: mismatched types
   --> /Users/omarhiari/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ctrlc-3.4.3/src/platform/unix/mod.rs:61:21
    |
61  |         Ok(_) => Ok(pipe),
    |                  -- ^^^^ expected `(i32, i32)`, found `(OwnedFd, OwnedFd)`
    |                  |
    |                  arguments to this enum variant are incorrect
    |
    = note: expected tuple `(i32, i32)`
               found tuple `(OwnedFd, OwnedFd)`
help: the type constructed contains `(OwnedFd, OwnedFd)` due to the type of the argument passed
   --> /Users/omarhiari/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ctrlc-3.4.3/src/platform/unix/mod.rs:61:18
    |
61  |         Ok(_) => Ok(pipe),
    |                  ^^^----^
    |                     |
    |                     this argument influences the type of `Ok`
note: tuple variant defined here
   --> /Users/omarhiari/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/result.rs:506:5
    |
506 |     Ok(#[stable(feature = "rust1", since = "1.0.0")] T),
    |     ^^

error[E0308]: mismatched types
    --> /Users/omarhiari/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ctrlc-3.4.3/src/platform/unix/mod.rs:63:35
     |
63   |             let _ = unistd::close(pipe.0);
     |                     ------------- ^^^^^^ expected `i32`, found `OwnedFd`
     |                     |
     |                     arguments to this function are incorrect
     |
note: function defined here
    --> /Users/omarhiari/.cargo/registry/src/index.crates.io-6f17d22bba15001f/nix-0.28.0/src/unistd.rs:1087:8
     |
1087 | pub fn close(fd: RawFd) -> Result<()> {
     |        ^^^^^

error[E0308]: mismatched types
    --> /Users/omarhiari/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ctrlc-3.4.3/src/platform/unix/mod.rs:64:35
     |
64   |             let _ = unistd::close(pipe.1);
     |                     ------------- ^^^^^^ expected `i32`, found `OwnedFd`
     |                     |
     |                     arguments to this function are incorrect
     |
note: function defined here
    --> /Users/omarhiari/.cargo/registry/src/index.crates.io-6f17d22bba15001f/nix-0.28.0/src/unistd.rs:1087:8
     |
1087 | pub fn close(fd: RawFd) -> Result<()> {
     |        ^^^^^

Seems related to this issue Detegr/rust-ctrlc#115
There seems to be a workaround, which didn't work for me really, however, can this can be fixed to not affect espflash?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions