watchexec/watchexec

watchexec@2.3 fails as a dependency

bryanburgers opened this issue ยท 6 comments

Depending on watchexec@2.3 fails for new projects (and presumably any project not using a Cargo.lock).

This can be reproduced by creating a new project with the following Cargo.toml

[package]
name = "watchexec-reproduction"
version = "0.1.0"
edition = "2021"

[dependencies]
watchexec = "2.3.0"
output of `cargo build`
    Checking watchexec v2.3.0
error[E0308]: mismatched types
   --> /Users/bryan/.cargo/registry/src/index.crates.io-6f17d22bba15001f/watchexec-2.3.0/src/command/supervisor.rs:124:44
    |
124 | ...                   if let Err(err) = process.signal(sig) {
    |                                                 ------ ^^^ expected `command_group::Signal`, found `nix::sys::signal::Signal`
    |                                                 |
    |                                                 arguments to this method are incorrect
    |
    = note: `nix::sys::signal::Signal` and `command_group::Signal` have similar names, but are actually distinct types
note: `nix::sys::signal::Signal` is defined in crate `nix`
   --> /Users/bryan/.cargo/registry/src/index.crates.io-6f17d22bba15001f/nix-0.27.1/src/sys/signal.rs:25:1
    |
25  | / libc_enum! {
26  | |     /// Types of operating system signals
27  | |     // Currently there is only one definition of c_int in libc, as well as only one
28  | |     // type for signal constants.
...   |
121 | |     impl TryFrom<i32>
122 | | }
    | |_^
note: `command_group::Signal` is defined in crate `nix`
   --> /Users/bryan/.cargo/registry/src/index.crates.io-6f17d22bba15001f/nix-0.26.4/src/sys/signal.rs:21:1
    |
21  | / libc_enum! {
22  | |     /// Types of operating system signals
23  | |     // Currently there is only one definition of c_int in libc, as well as only one
24  | |     // type for signal constants.
...   |
115 | |     impl TryFrom<i32>
116 | | }
    | |_^
    = note: perhaps two different versions of crate `nix` are being used?
note: method defined here
   --> /Users/bryan/.cargo/registry/src/index.crates.io-6f17d22bba15001f/watchexec-2.3.0/src/command/process.rs:37:9
    |
37  |     pub fn signal(&mut self, sig: command_group::Signal) -> Result<(), RuntimeError> {
    |            ^^^^^^            --------------------------
    = note: this error originates in the macro `libc_enum` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0308]: mismatched types
   --> /Users/bryan/.cargo/registry/src/index.crates.io-6f17d22bba15001f/watchexec-2.3.0/src/fs.rs:309:31
    |
309 |     tags.push(Tag::FileEventKind(nev.kind));
    |               ------------------ ^^^^^^^^ expected `FileEventKind`, found `EventKind`
    |               |
    |               arguments to this enum variant are incorrect
    |
    = note: `EventKind` and `FileEventKind` have similar names, but are actually distinct types
note: `EventKind` is defined in crate `notify`
   --> /Users/bryan/.cargo/registry/src/index.crates.io-6f17d22bba15001f/notify-5.2.0/src/event.rs:198:1
    |
198 | pub enum EventKind {
    | ^^^^^^^^^^^^^^^^^^
note: `FileEventKind` is defined in crate `notify`
   --> /Users/bryan/.cargo/registry/src/index.crates.io-6f17d22bba15001f/notify-6.1.1/src/event.rs:198:1
    |
198 | pub enum EventKind {
    | ^^^^^^^^^^^^^^^^^^
    = note: perhaps two different versions of crate `notify` are being used?
note: tuple variant defined here
   --> /Users/bryan/.cargo/registry/src/index.crates.io-6f17d22bba15001f/watchexec-events-1.1.0/src/event.rs:42:2
    |
42  |     FileEventKind(FileEventKind),
    |     ^^^^^^^^^^^^^

error[E0308]: mismatched types
   --> /Users/bryan/.cargo/registry/src/index.crates.io-6f17d22bba15001f/watchexec-2.3.0/src/paths.rs:124:5
    |
123 |             .entry(match kind {
    |                          ---- this expression has type `watchexec_events::filekind::FileEventKind`
124 |                 Modify(Data(_)) | Access(Close(Write)) => "WRITTEN",
    |                 ^^^^^^^^^^^^^^^ expected `FileEventKind`, found `EventKind`
    |
    = note: `EventKind` and `FileEventKind` have similar names, but are actually distinct types
note: `EventKind` is defined in crate `notify`
   --> /Users/bryan/.cargo/registry/src/index.crates.io-6f17d22bba15001f/notify-5.2.0/src/event.rs:198:1
    |
198 | pub enum EventKind {
    | ^^^^^^^^^^^^^^^^^^
note: `FileEventKind` is defined in crate `notify`
   --> /Users/bryan/.cargo/registry/src/index.crates.io-6f17d22bba15001f/notify-6.1.1/src/event.rs:198:1
    |
198 | pub enum EventKind {
    | ^^^^^^^^^^^^^^^^^^
    = note: perhaps two different versions of crate `notify` are being used?

error[E0308]: mismatched types
   --> /Users/bryan/.cargo/registry/src/index.crates.io-6f17d22bba15001f/watchexec-2.3.0/src/paths.rs:124:23
    |
123 |             .entry(match kind {
    |                          ---- this expression has type `watchexec_events::filekind::FileEventKind`
124 |                 Modify(Data(_)) | Access(Close(Write)) => "WRITTEN",
    |                                   ^^^^^^^^^^^^^^^^^^^^ expected `FileEventKind`, found `EventKind`
    |
    = note: `EventKind` and `FileEventKind` have similar names, but are actually distinct types
note: `EventKind` is defined in crate `notify`
   --> /Users/bryan/.cargo/registry/src/index.crates.io-6f17d22bba15001f/notify-5.2.0/src/event.rs:198:1
    |
198 | pub enum EventKind {
    | ^^^^^^^^^^^^^^^^^^
note: `FileEventKind` is defined in crate `notify`
   --> /Users/bryan/.cargo/registry/src/index.crates.io-6f17d22bba15001f/notify-6.1.1/src/event.rs:198:1
    |
198 | pub enum EventKind {
    | ^^^^^^^^^^^^^^^^^^
    = note: perhaps two different versions of crate `notify` are being used?

error[E0308]: mismatched types
   --> /Users/bryan/.cargo/registry/src/index.crates.io-6f17d22bba15001f/watchexec-2.3.0/src/paths.rs:125:5
    |
123 |             .entry(match kind {
    |                          ---- this expression has type `watchexec_events::filekind::FileEventKind`
124 |                 Modify(Data(_)) | Access(Close(Write)) => "WRITTEN",
125 |                 Modify(Metadata(_)) => "META_CHANGED",
    |                 ^^^^^^^^^^^^^^^^^^^ expected `FileEventKind`, found `EventKind`
    |
    = note: `EventKind` and `FileEventKind` have similar names, but are actually distinct types
note: `EventKind` is defined in crate `notify`
   --> /Users/bryan/.cargo/registry/src/index.crates.io-6f17d22bba15001f/notify-5.2.0/src/event.rs:198:1
    |
198 | pub enum EventKind {
    | ^^^^^^^^^^^^^^^^^^
note: `FileEventKind` is defined in crate `notify`
   --> /Users/bryan/.cargo/registry/src/index.crates.io-6f17d22bba15001f/notify-6.1.1/src/event.rs:198:1
    |
198 | pub enum EventKind {
    | ^^^^^^^^^^^^^^^^^^
    = note: perhaps two different versions of crate `notify` are being used?

error[E0308]: mismatched types
   --> /Users/bryan/.cargo/registry/src/index.crates.io-6f17d22bba15001f/watchexec-2.3.0/src/paths.rs:126:5
    |
123 |             .entry(match kind {
    |                          ---- this expression has type `watchexec_events::filekind::FileEventKind`
...
126 |                 Remove(_) => "REMOVED",
    |                 ^^^^^^^^^ expected `FileEventKind`, found `EventKind`
    |
    = note: `EventKind` and `FileEventKind` have similar names, but are actually distinct types
note: `EventKind` is defined in crate `notify`
   --> /Users/bryan/.cargo/registry/src/index.crates.io-6f17d22bba15001f/notify-5.2.0/src/event.rs:198:1
    |
198 | pub enum EventKind {
    | ^^^^^^^^^^^^^^^^^^
note: `FileEventKind` is defined in crate `notify`
   --> /Users/bryan/.cargo/registry/src/index.crates.io-6f17d22bba15001f/notify-6.1.1/src/event.rs:198:1
    |
198 | pub enum EventKind {
    | ^^^^^^^^^^^^^^^^^^
    = note: perhaps two different versions of crate `notify` are being used?

error[E0308]: mismatched types
   --> /Users/bryan/.cargo/registry/src/index.crates.io-6f17d22bba15001f/watchexec-2.3.0/src/paths.rs:127:5
    |
123 |             .entry(match kind {
    |                          ---- this expression has type `watchexec_events::filekind::FileEventKind`
...
127 |                 Create(_) => "CREATED",
    |                 ^^^^^^^^^ expected `FileEventKind`, found `EventKind`
    |
    = note: `EventKind` and `FileEventKind` have similar names, but are actually distinct types
note: `EventKind` is defined in crate `notify`
   --> /Users/bryan/.cargo/registry/src/index.crates.io-6f17d22bba15001f/notify-5.2.0/src/event.rs:198:1
    |
198 | pub enum EventKind {
    | ^^^^^^^^^^^^^^^^^^
note: `FileEventKind` is defined in crate `notify`
   --> /Users/bryan/.cargo/registry/src/index.crates.io-6f17d22bba15001f/notify-6.1.1/src/event.rs:198:1
    |
198 | pub enum EventKind {
    | ^^^^^^^^^^^^^^^^^^
    = note: perhaps two different versions of crate `notify` are being used?

error[E0308]: mismatched types
   --> /Users/bryan/.cargo/registry/src/index.crates.io-6f17d22bba15001f/watchexec-2.3.0/src/paths.rs:128:5
    |
123 |             .entry(match kind {
    |                          ---- this expression has type `watchexec_events::filekind::FileEventKind`
...
128 |                 Modify(Name(_)) => "RENAMED",
    |                 ^^^^^^^^^^^^^^^ expected `FileEventKind`, found `EventKind`
    |
    = note: `EventKind` and `FileEventKind` have similar names, but are actually distinct types
note: `EventKind` is defined in crate `notify`
   --> /Users/bryan/.cargo/registry/src/index.crates.io-6f17d22bba15001f/notify-5.2.0/src/event.rs:198:1
    |
198 | pub enum EventKind {
    | ^^^^^^^^^^^^^^^^^^
note: `FileEventKind` is defined in crate `notify`
   --> /Users/bryan/.cargo/registry/src/index.crates.io-6f17d22bba15001f/notify-6.1.1/src/event.rs:198:1
    |
198 | pub enum EventKind {
    | ^^^^^^^^^^^^^^^^^^
    = note: perhaps two different versions of crate `notify` are being used?

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

This seems to happen on both MacOS and on Linux.

This caused errors in cargo-lambda: cargo-lambda/cargo-lambda#573

Pinning watchexec-signals to the previous version solved this compilation problem for us:
watchexec-signals = "=1.0.0"

hmm. would releasing a 2.3.x with a pin on the signals dependency work for you or would you rather i yank and major-break signals?

hmm. would releasing a 2.3.x with a pin on the signals dependency work for you or would you rather i yank and major-break signals?

Our issue is solved for now, and we'll go to 3.0.0 in the future, so no strong preference. Major-break may be warranted if it isn't planned to be compatible?

it's a dependency thing, with the nix package, those are always ambiguously semver affecting; the signals package code itself hasn't changed

it's a dependency thing, with the nix package, those are always ambiguously semver affecting; the signals package code itself hasn't changed

Maybe the pin 2.3.x path is more appetizing then, to leave that in a good state? Again no strong preference ๐Ÿ™‚

Aight, published a 2.3.1 with pinned dependencies. Thanks for reporting!