Hi, I'm a Nix user and recently the Rust/Nix tools i'm using (like crate2nix) broke because of changes introduced in rand - In the end it probably just boils down to missing renaming support and of course this is none of your concern/responsibility.
However I would be really grateful if you could help me to understand how you are using getrandom / getrandom_package because i am still confused about it.
The first thing I dug up was this comment #800 (comment)
Optional dependencies can be used as feature flags, but I don't think
it's possible to make them depend on anything transitively. I want
getrandom to imply "rand_core/getrandom"; this is a hack to do that.
This of course refers to the following setup in the Cargo.toml:
[features]
getrandom = ["getrandom_package", "rand_core/getrandom"]
[dependencies]
getrandom_package = { version = "0.1.1", package = "getrandom", optional = true }
So rand is exposing a getrandom feature which introduces a dependency on getrandom_package. getrandom_package (which doesn't actually exist anywhere) is mapped/renamed to use getrandom. In addition to that the getrandom feature also introduces a dependency on rand_core/getrandom.
It would be great if someone could explain the motivation behind this to me. Couldn't this just be replaced with something like
[features]
random = ["getrandom", "rand_core/getrandom"]
# getrandom = ["getrandom", "rand_core/getrandom"] circular dep problem (?)
Is the hack necessary to avoid some otherwise occurring breakage? I'd be most grateful if someone could explain this to me. I'm sorry if this is entirely obvious, i am not that experienced with Rust yet.
Thanks a lot in advance folks.
Hi, I'm a Nix user and recently the Rust/Nix tools i'm using (like crate2nix) broke because of changes introduced in
rand- In the end it probably just boils down to missing renaming support and of course this is none of your concern/responsibility.However I would be really grateful if you could help me to understand how you are using
getrandom/getrandom_packagebecause i am still confused about it.The first thing I dug up was this comment #800 (comment)
This of course refers to the following setup in the
Cargo.toml:So
randis exposing agetrandomfeature which introduces a dependency ongetrandom_package.getrandom_package(which doesn't actually exist anywhere) is mapped/renamed to usegetrandom. In addition to that thegetrandomfeature also introduces a dependency onrand_core/getrandom.It would be great if someone could explain the motivation behind this to me. Couldn't this just be replaced with something like
Is the hack necessary to avoid some otherwise occurring breakage? I'd be most grateful if someone could explain this to me. I'm sorry if this is entirely obvious, i am not that experienced with Rust yet.
Thanks a lot in advance folks.