Repository: watchexec/cargo-watch

Issue #304: `cargo install` failed on Windows 11
Created: 2024-05-04T17:33:58Z
Hello, I'm trying to install cargo-watch on Windows 11 with cargo install, but it ran into an issue while compiling:
$ cargo install cargo-watch
    Updating crates.io index
  Installing cargo-watch v8.5.2
    Updating crates.io index
   Compiling proc-macro2 v1.0.81
   Compiling unicode-ident v1.0.12
   <... lots of lines ...>
   Compiling which v4.4.2
   Compiling darling_core v0.12.4
   Compiling notify v4.0.17
   Compiling command-group v1.0.8
error[E0308]: mismatched types
   --> C:\Users\thainguyen\.cargo\registry\src\index.crates.io-6f17d22bba15001f\notify-4.0.17\src\windows.rs:276:29
    |
276 |         overlapped.hEvent = request_p;
    |         -----------------   ^^^^^^^^^ expected `winapi::ctypes::c_void`, found `libc::c_void`
    |         |
    |         expected due to the type of this binding
    |
    = note: `libc::c_void` and `winapi::ctypes::c_void` have similar names, but are actually distinct types
note: `libc::c_void` is defined in crate `core`
   --> C:\Users\thainguyen\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib/rustlib/src/rust\library\core\src\ffi\mod.rs:183:1
    |
183 | pub enum c_void {
    | ^^^^^^^^^^^^^^^
note: `winapi::ctypes::c_void` is defined in crate `winapi`
   --> C:\Users\thainguyen\.cargo\registry\src\index.crates.io-6f17d22bba15001f\winapi-0.3.9\src\lib.rs:38:5
    |
38  |     pub enum c_void {}
    |     ^^^^^^^^^^^^^^^

error[E0308]: mismatched types
    --> C:\Users\thainguyen\.cargo\registry\src\index.crates.io-6f17d22bba15001f\notify-4.0.17\src\windows.rs:282:13
     |
280  |         let ret = winbase::ReadDirectoryChangesW(
     |                   ------------------------------ arguments to this function are incorrect
281  |             handle,
282  |             req_buf,
     |             ^^^^^^^ expected `winapi::ctypes::c_void`, found `libc::c_void`
     |
     = note: `libc::c_void` and `winapi::ctypes::c_void` have similar names, but are actually distinct types
note: `libc::c_void` is defined in crate `core`
    --> C:\Users\thainguyen\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib/rustlib/src/rust\library\core\src\ffi\mod.rs:183:1
     |
183  | pub enum c_void {
     | ^^^^^^^^^^^^^^^
note: `winapi::ctypes::c_void` is defined in crate `winapi`
    --> C:\Users\thainguyen\.cargo\registry\src\index.crates.io-6f17d22bba15001f\winapi-0.3.9\src\lib.rs:38:5
     |
38   |     pub enum c_void {}
     |     ^^^^^^^^^^^^^^^
note: function defined here
    --> C:\Users\thainguyen\.cargo\registry\src\index.crates.io-6f17d22bba15001f\winapi-0.3.9\src\um\winbase.rs:2072:12
     |
2072 |     pub fn ReadDirectoryChangesW(
     |            ^^^^^^^^^^^^^^^^^^^^^

For more information about this error, try `rustc --explain E0308`.
error: could not compile `notify` (lib) due to 2 previous errors
warning: build failed, waiting for other jobs to finish...
error: failed to compile `cargo-watch v8.5.2`, intermediate artifacts can be found at `C:\Users\THAING~1\AppData\Local\Temp\cargo-installzpBRP9`.
To reuse those artifacts with a future compilation, set the environment variable `CARGO_TARGET_DIR` to that path.
Here's my current rust and cargo version:
$ cargo --version --verbose
cargo 1.78.0 (54d8815d0 2024-03-26)
release: 1.78.0
commit-hash: 54d8815d04fa3816edc207bbc4dd36bf18014dbc
commit-date: 2024-03-26
host: x86_64-pc-windows-msvc
libgit2: 1.7.2 (sys:0.18.2 vendored)
libcurl: 8.6.0-DEV (sys:0.4.72+curl-8.6.0 vendored ssl:Schannel)
os: Windows 10.0.22631 (Windows 11 Education) [64-bit]

$ rustc --version --verbose
rustc 1.78.0 (9b00956e5 2024-04-29)
binary: rustc
commit-hash: 9b00956e56009bab2aa15d7bff10916599e3d6d6
commit-date: 2024-04-29
host: x86_64-pc-windows-msvc
release: 1.78.0
LLVM version: 18.1.2

Duplicate issue #306: Mismatched type errors preventing build
Created: 2024-05-12T18:52:37Z
I don't know whether this is the appropriate place but I'm having issues when trying to build it as I was following along the Zero to Production book.
It says there are 2 mismatched type errors in the notify (lib)?
expected winapi::ctypes::c_void, found libc::c_void in line 276 of windows.rs
expected winapi::ctypes::c_void, found libc::c_void in line 282 of windows.rs
I uploaded screenshots, maybe it can help.

Closing comment (2024-05-12T22:18:58Z): Use --locked
Duplicate of #304