Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optional std in optional dependencies #110

Closed
dhardy opened this issue Sep 20, 2019 · 2 comments
Closed

Optional std in optional dependencies #110

dhardy opened this issue Sep 20, 2019 · 2 comments

Comments

@dhardy
Copy link
Member

dhardy commented Sep 20, 2019

#106 makes std optional.

To quote myself (to create an open issue):

I foresee an issue here: rand_core has optional dependencies on getrandom and std, and now needs to depend on getrandom/std only if both are enabled. I'm not sure how to do that. See here where the same issue came up recently.

This is really a Cargo issue IMO, but something we may have to find a workaround to.

@josephlr
Copy link
Member

josephlr commented Sep 20, 2019

Is this an issue if the rand_core's std feature unconditionally enables getrandom? That seems to be what it does currently.

Also, #106 doesn't actually change much regarding this. std was already optional for many targets on getrandom (like Windows) before that change. The PR just makes the feature act consistently.

@newpavlov
Copy link
Member

No, the problem is that rand_core uses getrandom's std feature for converting getrandom::Error into Box<dyn std::error::Error>. We want to enable std feature for getrandom only if both getrandom and std features are enabled for rand_core, but unfortunately AFAIK it's impossible to define such relation right now, since std = ["getrandom/std"] will enable getrandom optional dependency. So we either can't enable std feature for getrandom or we always depend on getrandom with an enabled std feature.

But actually it does not matter for rand_core v0.5, since it always enables getrandom with an enabled std feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants