feat(quinn-proto): Make compilable in wasm32-unknown-unknown and run wasm tests in CI#1996
Conversation
ac454b7 to
f19f900
Compare
0fb3ba0 to
2d5dfde
Compare
|
Thanks for the review. Thoughts on this open question?
I'm on the fence. I think it may be better to depend on |
I'm inclined to stick with depending on web_time only for WASM targets. IMO mainstream platforms should not bear the cost of niche platforms even if the overhead is small. @Ralith any thoughts? |
93e03ab to
451c911
Compare
Given that the amount of extra code is pretty trivial, this stance seems reasonable to me. I know I'd be a bit confused as a non-web user to see a web crate show up in my environment. |
Ralith
left a comment
There was a problem hiding this comment.
The wasm_bindgen_test churn is unfortunate, but I guess there's nothing for it.
|
@matheus23 this is currently failing the WASM test, I guess that's not supposed to be intentional? |
dc4dcb2 to
7b2af82
Compare
|
Seems like there's potentially some ring issues with wasm32. |
|
Okay, got to somewhat of the bottom on this. The stacktraces you saw were v8 crashing for some reason. |
7b2af82 to
fbb8a93
Compare
|
Also seems like |
aa9559d to
75a1b3c
Compare
75a1b3c to
9106a42
Compare
|
FWIW, this PR is ready from my perspective. Is there anything left to do? Do you want to re-review? |
|
Thanks, this is looking good! |
Summary of Changes
web_timedependency instead ofstd::time& re-exportInstant,Duration,SystemTimeandUNIX_EPOCHinlib.rsso imports are simplercrate::{Instant, Duration, ...}instead ofstd::time::{Instant, Duration, ...}wasm-bindgen-testto enable running tests from a Wasm buildRunning
quinn-prototests in WasmOld open questions, now resolved
Should the added code/dependencies additionally be feature-gated?
I personally don't think so. As far as I know, there's practically no one asking for wasm32-unknown-unknown compilability who isn't targeting nodejs/browsers/cloudflare workers/etc. and in all of these cases wasm-bindgen is the de-facto standard.
There's also targeting wasmtime and other runtimes, but IMO those needs are met by
wasm32-wasi-*targets, notwasm32-unknown-unknown.That said, for my intents and purposes that's mostly a cosmetic question, I don't mind having to enable another feature flag. Other concerns could be "what non-web
wasm32-unknown-unknownbecomes a thing and we need to break compatibility by introducing features?".Should the
Duration,Instant, etc. re-exports live inlib.rs?They're
pub(crate)only, so I don't think it matters much. I can move them into a file if you want, or we keep them here.Should we just depend on
web_timeinstead ofstd::timeeverywhere instead of cfg-gating & re-exporting?web_timeitself already multiplexes betweenstd::timeand a web-based implementation. So in a way, we're doing it twice here. What we gain is not depending onweb_timemost of the time.However, once we work on Wasm support for e.g.
quinnitself, we'd need to do this whole re-export dance, again. So perhaps it'd be better to just depend onweb_timeeverywhere?