-
-
Notifications
You must be signed in to change notification settings - Fork 394
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(quinn-proto): Make compilable in wasm32-unknown-unknown and run wasm tests in CI #1996
Conversation
ac454b7
to
f19f900
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, this looks like a reasonable direction!
Please squash all the changes into a single commit, as these commits are not conceptually separate.
0fb3ba0
to
2d5dfde
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking pretty good!
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? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, please squash the commits?
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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_time
dependency instead ofstd::time
& re-exportInstant
,Duration
,SystemTime
andUNIX_EPOCH
inlib.rs
so imports are simplercrate::{Instant, Duration, ...}
instead ofstd::time::{Instant, Duration, ...}
wasm-bindgen-test
to enable running tests from a Wasm buildRunning
quinn-proto
tests 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-unknown
becomes 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_time
instead ofstd::time
everywhere instead of cfg-gating & re-exporting?web_time
itself already multiplexes betweenstd::time
and a web-based implementation. So in a way, we're doing it twice here. What we gain is not depending onweb_time
most of the time.However, once we work on Wasm support for e.g.
quinn
itself, we'd need to do this whole re-export dance, again. So perhaps it'd be better to just depend onweb_time
everywhere?