rust-lang / rustlings

:crab: Small exercises to get you used to reading and writing Rust code!
https://rustlings.cool
MIT License
54.07k stars 10.15k forks source link

cargo install cargo-watch #1967

Closed note8g2018 closed 6 months ago

note8g2018 commented 6 months ago

I am trying to install cargo install cargo-watch then get the following error:


error[E0308]: mismatched types
   --> C:\Users\sky7\.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\sky7\.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\sky7\.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\sky7\.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\sky7\.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\sky7\.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\sky7\.cargo\registry\src\index.crates.io-6f17d22bba15001f\winapi-0.3.9\src\um\winbase.rs:2072:12
     |
2072 |     pub fn ReadDirectoryChangesW(
     |            ^^^^^^^^^^^^^^^^^^^^^

 Compiling command-group v1.0.8
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\sky7\AppData\Local\Temp\cargo-installzWDEJ2`.
To reuse those artifacts with a future compilation, set the environment variable `CARGO_TARGET_DIR` to that path.

My OS: windows 10 pro x64

mo8it commented 6 months ago

This is not a Rustlings issue. But still, some people had this issue with Rustlings some days ago. I opned an issue for it on the notify repo: https://github.com/notify-rs/notify/issues/586

For now, the solution is to add --locked. So cargo install --locked cargo-watch

0xpr03 commented 6 months ago

I recommend upgrading notify. You're on a 3 years old release.

Edit: your watchexec stuff is where this comes from, that's 3 years outdated.

mo8it commented 6 months ago

Rustlings v6 will be using the latest notify version.