quinn-rs / quinn

Async-friendly QUIC implementation in Rust
Apache License 2.0
3.76k stars 380 forks source link

Fix build errors so quinn-proto can be used under wasm32-unknown-unknown #1387

Closed thombles closed 2 years ago

thombles commented 2 years ago

This fixes a handful of basic things so that quinn-proto (with no default features) cleanly builds under the wasm32-unknown-unknown target, and can be used with a browser-based wasm-bindgen-test runner.

   Compiling quinn-proto v0.8.0 (/home/tk/repos/quinn/quinn-proto)
error[E0283]: type annotations needed
   --> /home/tk/repos/quinn/quinn-proto/src/connection/streams/recv.rs:150:23
    |
150 |             if offset != final_offset.into() {
    |                       ^^ ------------------- this method call resolves to `T`
    |                       |
    |                       cannot infer type
    |
    = note: multiple `impl`s satisfying `u64: PartialEq<_>` found in the following crates: `core`, `serde_json`:
            - impl PartialEq for u64;
            - impl PartialEq<serde_json::value::Value> for u64;

error[E0283]: type annotations needed
   --> /home/tk/repos/quinn/quinn-proto/src/connection/streams/state.rs:285:26
    |
285 |         Ok(if bytes_read != final_offset.into() {
    |                          ^^ ------------------- this method call resolves to `T`
    |                          |
    |                          cannot infer type
    |
    = note: multiple `impl`s satisfying `u64: PartialEq<_>` found in the following crates: `core`, `serde_json`:
            - impl PartialEq for u64;
            - impl PartialEq<serde_json::value::Value> for u64;

error[E0282]: type annotations needed
   --> /home/tk/repos/quinn/quinn-proto/src/connection/mod.rs:746:62
    |
746 |                         == self.path.max_udp_payload_size as _),
    |                                                              ^ cannot infer type
    |
    = note: type must be known at this point