-
-
Notifications
You must be signed in to change notification settings - Fork 17
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
Fix jitter causing panics on wasm32-unknown-unknown #2
Conversation
@@ -20,6 +20,9 @@ categories = [ | |||
maintenance = { status = "actively-developed" } | |||
|
|||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | |||
[features] | |||
wasm-bindgen = ["rand/wasm-bindgen"] |
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.
@Zireael-N does this relate to your other pull?
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.
I'd like to better understand how to catch these errors. I'm new to the wasm world so I may do something run but wouldn't this catch it?
again/.github/workflows/main.yml
Line 46 in 928e06c
run: cargo build --target wasm32-unknown-unknown |
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.
It's a runtime error.
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.
I think, the easiest thing you can do is to make CI build a wasm binary and then attempt to interface with it via NodeJS to see if it throws an exception.
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.
Actually, this won't work with NodeJS because wasm-timer
assumes that it's being run in a browser and expects window
to be available. :(
wasm-bindgen
, according to its guide, can run tests using headless browsers but I've never done that.
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 thread might be helpful. it seems possible to get rand working with wasm bindgen. I'll do some research rust-random/rand#616
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.
It does work if you use the wasm-bindgen
feature. The features I added in this PR just tell cargo to enable corresponding features while compiling rand
.
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.
Aha rust-random/rand#810 (comment) I was missing a bit of context here. Can you merge master to fix the merge conflict. I'll merge this aftet
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.
Rebased and force-pushed.
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.
I'll follow up on figuring out what an integration test looks like this in ci in #4
thanks for your patches @Zireael-N I just published a new version with your other change and a new version with this change should be on its way to crates.io shortly https://github.com/softprops/again/actions/runs/120210531 |
getrandom
, whichrand
depends on, needs to know how to interface with JS in order to work. Otherwise, it causes an "unreachable" error:https://github.com/rust-random/getrandom/tree/0ad1c7721455b644a775bb4647806ab631250c14#features