nix-community / crate2nix

rebuild only changed crates in CI with crate2nix and nix
https://nix-community.github.io/crate2nix/
Apache License 2.0
374 stars 89 forks source link

doesn't handle target.crossbeam_loom correctly #168

Closed fogti closed 3 years ago

fogti commented 3 years ago

relates to the following stmt from the README.md:

It does translates target strings to nix expressions. The support should be reasonable but probably not complete - please let me know if you hit problems.

trace: https://gist.github.com/zseri/44eb7052e9634e2761e459272eab05c4

fogti commented 3 years ago

probably stems from this file: https://github.com/crossbeam-rs/crossbeam/blob/d841a2028dc72b4e09739116f07e865db60f3690/crossbeam-utils/Cargo.toml

# Enable the use of loom for concurrency testing.
#
# This configuration option is outside of the normal semver guarantees: minor
# versions of crossbeam may make breaking changes to it at any time.
[target.'cfg(crossbeam_loom)'.dependencies]
loom = { version = "0.4", optional = true }
fogti commented 3 years ago

In crate2nix/templates/nix/crate2nix/default.nix, defaultTarget should contain crossbeam_loom = false;.

fogti commented 3 years ago

But this is not a long-term solution. crate2nix should find all used feature tags used in target.cfg(XXX) form in Cargo.toml files, and use e.g. builtins.elem "crossbeam_loom" features instead of target."crossbeam_loom".

fogti commented 3 years ago

oh no, this is not completely correct... there should be a separate category besides features, targetFeatures, target, e.g. rawFeature, which contains such flags and is merged with target early...

fogti commented 3 years ago

uhh, and this seems to be already fixed, now, as I read the source code, but the fix is not present in the published 0.8.0 version... :-(