Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

expected enum winapi::ctypes::c_void, found enum std::ffi::c_void #136

Closed
thy1037 opened this issue Dec 8, 2022 · 4 comments
Closed

expected enum winapi::ctypes::c_void, found enum std::ffi::c_void #136

thy1037 opened this issue Dec 8, 2022 · 4 comments

Comments

@thy1037
Copy link

thy1037 commented Dec 8, 2022

When I add tokio-modbus as a dependencies, cargo build will failed.

Reproduction:

  1. cargo new a new project
  2. add tokio-modbus = "0.5.3" to Cargo.toml
  3. copy the example tcp-client code to main.rs
  4. run cargo build, and show:
   Compiling mio-serial v5.0.3
error[E0308]: mismatched types
   --> C:\Users\dell\.cargo\registry\src\mirrors.ustc.edu.cn-61ef6e0cd06fb9b8\mio-serial-5.0.3\src\lib.rs:822:42
    |
822 |         let r = unsafe { SetCommTimeouts(handle, &mut timeouts) };
    |                          --------------- ^^^^^^ expected enum `winapi::ctypes::c_void`, found enum `std::ffi::c_void`
    |                          |
    |                          arguments to this function are incorrect
    |
    = note: expected raw pointer `*mut winapi::ctypes::c_void`
               found raw pointer `*mut std::ffi::c_void`
note: function defined here
   --> C:\Users\dell\.cargo\registry\src\mirrors.ustc.edu.cn-61ef6e0cd06fb9b8\winapi-0.3.9\src\um\commapi.rs:74:12
    |
74  |     pub fn SetCommTimeouts(
    |            ^^^^^^^^^^^^^^^

For more information about this error, try `rustc --explain E0308`.
error: could not compile `mio-serial` due to previous error

Environment:
Win10
rustc 1.65.0 (897e37553 2022-11-02)
rustup 1.25.1 (bb60b1e89 2022-07-12)
x86_64-pc-windows-msvc

@uklotzde
Copy link
Member

uklotzde commented Dec 8, 2022

Probably caused by tokio-rs/tokio#5204.

@uklotzde
Copy link
Member

uklotzde commented Dec 8, 2022

Confirmed: https://github.com/slowtec/tokio-modbus/actions/runs/3647400977/jobs/6159588455

Please try to pin your tokio version to 1.22.0 until the incompatibilities have been resolved.

@thy1037
Copy link
Author

thy1037 commented Dec 9, 2022

Confirmed: https://github.com/slowtec/tokio-modbus/actions/runs/3647400977/jobs/6159588455

Please try to pin your tokio version to 1.22.0 until the incompatibilities have been resolved.

Add tokio = {version = "=1.22.0", features = ["full"]} to Cargo.toml, the incompatibilities can be resolved.

But running has problem, create a new issue #138

@uklotzde
Copy link
Member

Fixed by #139.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants