lerouxrgd/datachannel-rs

`error[E0308]: mismatched types`

WilliamVenner opened this issue · 4 comments

   Compiling datachannel-sys v0.13.4
   Compiling datachannel v0.6.1
error[E0308]: mismatched types
  --> C:\Users\billy\.cargo\registry\src\github.com-1ecc6299db9ec823\datachannel-0.6.1\src\config.rs:97:15
   |
97 |     Default = sys::rtcCertificateType_RTC_CERTIFICATE_DEFAULT,
   |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `u32`, found `i32`

error[E0308]: mismatched types
  --> C:\Users\billy\.cargo\registry\src\github.com-1ecc6299db9ec823\datachannel-0.6.1\src\config.rs:98:13
   |
98 |     ECDSA = sys::rtcCertificateType_RTC_CERTIFICATE_ECDSA,
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `u32`, found `i32`

error[E0308]: mismatched types
  --> C:\Users\billy\.cargo\registry\src\github.com-1ecc6299db9ec823\datachannel-0.6.1\src\config.rs:99:11
   |
99 |     RSA = sys::rtcCertificateType_RTC_CERTIFICATE_RSA,
   |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `u32`, found `i32`

Changing #[repr(u32)] to #[repr(i32)] and certificateType: self.certificate_type as u32 to certificateType: self.certificate_type as i32 fixed this for me, but I don't understand why they were u32 in the first place - is it an OS difference? I'm on Windows x64

It looks like bindgen generates u32 for C enum values on Linux/macOS but i32 for windows ...
I'll look into it.

@WilliamVenner I pushed a fix on master, could you give it a try and let me know whether it works for you on Windows ?

It should be fixed in 0.6.3

Closing this, don't hesitate to re-open if you're still seeing the issue.