Skip to content

rand with stdweb feature is not compatible with --nodejs in wasm32-unkown-unknown target #445

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

Closed
huangjj27 opened this issue May 12, 2018 · 3 comments

Comments

@huangjj27
Copy link

after we tried fix #442
We found another incompatibility with --nodejs in wasm32-unknown-unknown:

$ cargo web test --target wasm32-unknown-unknown --nodejs --features=stdweb

   Compiling rand v0.5.0-pre.1 (file:///home/travis/build/rust-lang-nursery/rand)
    Finished release [optimized] target(s) in 2m 52.05s
    Garbage collecting "rand-d938d9acf7a83c4e.wasm"...
    Processing "rand-d938d9acf7a83c4e.wasm"...
    Finished processing of "rand-d938d9acf7a83c4e.wasm"!
/home/travis/build/rust-lang-nursery/rand/target/wasm32-unknown-unknown/release/rand-d938d9acf7a83c4e.js:38
                Module.STDWEB_PRIVATE.from_js($0, (function(){try {if (typeof window ==="object" && typeof window.crypto ==="object" && typeof window.crypto.getRandomValues ==="function"){return {success : true , ty : 1};}if (typeof require ("crypto"). randomBytes ==="function"){return {success : true , ty : 2};}return {success : false , error : new Error ("not supported")};}catch (err){return {success : false , error : err};}})());
                                      ^
TypeError: Cannot read property 'from_js' of undefined
    at __extjs_a2b16af65ac827473a87874794e6d61f99e2f317 (/home/travis/build/rust-lang-nursery/rand/target/wasm32-unknown-unknown/release/rand-d938d9acf7a83c4e.js:38:39)
    at rand::rngs::os::imp::OsRng::new::h765774a72c995801 (wasm-function[271]:97)
    at <rand::rngs::entropy::EntropyRng as rand_core::RngCore>::try_fill_bytes::h4899823cf0992da6 (wasm-function[252]:77)
    at rand::rngs::entropy::test::test_entropy::h5e484e5b8820ab29 (wasm-function[324]:41)
    at core::ops::function::FnOnce::call_once::h860ee6e300ec4137 (wasm-function[191]:13)
    at test::__rust_begin_short_backtrace::h23505ea987312149 (wasm-function[412]:3)
    at <F as alloc::boxed::FnBox<A>>::call_box::hb638f3d42164cc67 (wasm-function[411]:6)
    at std::panicking::try::do_call::h4a21a145363e9b4e (wasm-function[646]:17)
    at __rust_maybe_catch_panic (wasm-function[1501]:5)
    at test::run_test::run_test_inner::hdc7d7a13372b29ed (wasm-function[444]:801)
@pitdicker
Copy link
Contributor

Testing with wasm32-unknown-unknown and nodejs is tested with every PR by Travis, ans it is supposed to work. It was just my PR which was wrong and failed.

@huangjj27
Copy link
Author

But as the log shown above, it is in the --nodejs test that the CI build failed

@pitdicker
Copy link
Contributor

I had exactly the same error locally, but it runs the tests successfully with the cargo.toml from master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants