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
{{ message }}
Repository navigation
Cannot compile to wasm without wasm-bindgen with v0.8.1 #140
In fact, the standard ahash with default-features = false will ALWAYS bring in wasm-bindgen (you can tell by inspecting Cargo.lock) for ANY TARGET and all its dependencies for no apparent reason, all because getrandom/js is turned on.
That is because cargo seems to merge the features regardless of whether they only showed up in specific target sections. Once it shows up in one target, it shows up in all targets.
[target."cfg(not(any(target_arch = \"wasm32\", target_abi = \"unknown\")))".dependencies.getrandom] does not appear to prevent the js feature from being added to getrandom (not to mention target_abi does not seem to be stabilized yet) even when the target is not wasm32.
Therefore, there is no way to "turn off" getrandom/js, which breaks no-std in a major way.
Supposedly resolver = "2" will resolve (pun intended) this target-specific features issue, but in my tests this is not the case, as confirmed by the GitHub issues. resolver = "2" doesn't prevent features set on targets not built to be merged.
Activity
schungx commentedon Nov 3, 2022
I agree adding a
jsfeature that maps togetrandom/jsis best.I used to manually set
getrandom/jswhenever I seewasm-bindgensoahashworks properly but then the new version now has no way to turn it off.schungx commentedon Nov 5, 2022
This also causes #141 which breaks
no-stdbuilds.schungx commentedon Nov 5, 2022
In fact, the standard
ahashwithdefault-features = falsewill ALWAYS bring inwasm-bindgen(you can tell by inspectingCargo.lock) for ANY TARGET and all its dependencies for no apparent reason, all becausegetrandom/jsis turned on.That is because
cargoseems to merge the features regardless of whether they only showed up in specific target sections. Once it shows up in one target, it shows up in all targets.[target."cfg(not(any(target_arch = \"wasm32\", target_abi = \"unknown\")))".dependencies.getrandom]does not appear to prevent thejsfeature from being added togetrandom(not to mentiontarget_abidoes not seem to be stabilized yet) even when the target is notwasm32.Therefore, there is no way to "turn off"
getrandom/js, which breaksno-stdin a major way.schungx commentedon Nov 5, 2022
rust-lang/cargo#4866 and rust-lang/cargo#1197 document the fact that target-specific features are not supported. All features are merged regardless of target.
Supposedly
resolver = "2"will resolve (pun intended) this target-specific features issue, but in my tests this is not the case, as confirmed by the GitHub issues.resolver = "2"doesn't prevent features set on targets not built to be merged.tkaitchuck commentedon Nov 10, 2022
Fixed