GithubHelp home page GithubHelp logo

Comments (5)

schungx avatar schungx commented on June 12, 2024

I agree adding a js feature that maps to getrandom/js is best.

I used to manually set getrandom/js whenever I see wasm-bindgen so ahash works properly but then the new version now has no way to turn it off.

from ahash.

schungx avatar schungx commented on June 12, 2024

This also causes #141 which breaks no-std builds.

from ahash.

schungx avatar schungx commented on June 12, 2024

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.

from ahash.

schungx avatar schungx commented on June 12, 2024

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.

from ahash.

tkaitchuck avatar tkaitchuck commented on June 12, 2024

Fixed

from ahash.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.