Skip to content

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

@thy1037

Description

@thy1037

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions