quinn-rs / quinn

Async-friendly QUIC implementation in Rust
Apache License 2.0
3.85k stars 394 forks source link

Fails to build: error[E0308]: mismatched types #1362

Closed yurivict closed 2 years ago

yurivict commented 2 years ago

The solana project fails:

error[E0308]: mismatched types
   --> /wrkdirs/usr/ports/security/solana/work/solana-1.10.21/cargo-crates/quinn-udp-0.1.0/src/unix.rs:232:72
    |
232 |             unsafe { libc::sendmmsg(io.as_raw_fd(), msgs.as_mut_ptr(), num_transmits as u32, 0) };
    |                                                                        ^^^^^^^^^^^^^^^^^^^^ expected `usize`, found `u32`
    |
help: you can convert a `u32` to a `usize` and panic if the converted value doesn't fit
    |
232 |             unsafe { libc::sendmmsg(io.as_raw_fd(), msgs.as_mut_ptr(), (num_transmits as u32).try_into().unwrap(), 0) };
    |                                                                        +                    +++++++++++++++++++++

error[E0308]: mismatched types
   --> /wrkdirs/usr/ports/security/solana/work/solana-1.10.21/cargo-crates/quinn-udp-0.1.0/src/unix.rs:341:17
    |
341 |                 bufs.len().min(BATCH_SIZE) as libc::c_uint,
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `usize`, found `u32`
    |
help: you can convert a `u32` to a `usize` and panic if the converted value doesn't fit
    |
341 |                 (bufs.len().min(BATCH_SIZE) as libc::c_uint).try_into().unwrap(),
    |                 +                                          +++++++++++++++++++++

rust-1.60.0 FreeBSD 13.1

Ralith commented 2 years ago

Dup of https://github.com/quinn-rs/quinn/issues/1142. Contributions would be welcome.