You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This enables it through the `RUSTFLAGS` environment variable, doing
so for the `wasm32-unknown-unknown` target only.
This is to address:
error: The wasm32-unknown-unknown targets are not supported by default; you may need to enable the "wasm_js" configuration flag. Note that enabling the `wasm_js` feature flag alone is insufficient. For more information see: https://docs.rs/getrandom/0.3.3/#webassembly-support
--> /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/getrandom-0.3.3/src/backends.rs:168:9
|
168 | / compile_error!(concat!(
169 | | "The wasm32-unknown-unknown targets are not supported by default; \
170 | | you may need to enable the \"wasm_js\" configuration flag. Note \
171 | | that enabling the `wasm_js` feature flag alone is insufficient. \
172 | | For more information see: \
173 | | https://docs.rs/getrandom/", env!("CARGO_PKG_VERSION"), "/#webassembly-support"
174 | | ));
However, it is not necessarily the best way to do it. If we want
the `wasm` feature, which is intentionally not a default feature
even on WASM targets, to be sufficient to enable this behavior,
then we might not be able to use `getrandom` 0.3.
The documentation at https://docs.rs/getrandom/0.3.3/getrandom
suggests doing something like this in `.cargo/config.toml`:
[target.wasm32-unknown-unknown]
rustflags = ['--cfg', 'getrandom_backend="wasm_js"']
However, this would be done in the crate that uses `gix-diff`.
Doing it here would not alleviate those using `gix-diff` of the
need to do so. It could be done here for WASM tests, but we don't
currently run tests on WASM. It could be done for the checks that
WASM builds that are done in the `wasm` job on CI, but we probably
shouldn't do that, because the current approach there of setting
`RUSTFLAGS` is more granular; we would want to find out if more
crates start needing this functionality in order to build.
For more on backends including the `wasm_js` backend, see:
https://docs.rs/getrandom/0.3.3/getrandom/#opt-in-backends
0 commit comments