-
Notifications
You must be signed in to change notification settings - Fork 10
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
Recommended usage is impossible to satisfy #19
Comments
It is easy to satisfy really. Just provide nightly feature if you depend on Then in case of large project stumbled on that library being added as dependency without enabling "nightly", large project can add that library as dependency and enable "nightly". I guess better phrasing for the README would be Your library MUST provide a feature that will enable "allocator-api2/nightly" |
That's also not satisfactory because this would need to infect the entire dependency chain to work. If not the exact same example is problematic again, just with one extra dependency:
Here |
Yes, but can be fixed in root crate, by turning on nightly in c |
The root crate does not depend on It's just not a reasonable system. Suppose |
Yes, but only if they want to build on nightly and enable "nightly" features in at least some of their dependencies that reaches I would love to be able to enable lang features based on features enabled in dependency alone. Without special feature enabled for the crate. So enabling "nightly" in transitive dependencies root crate doesn't care about is the lesser evil. Please share if you know how to make it work without such friction. |
The recommended usage section in the README states the following:
This is impossible because of feature unification. Consider there are two crates
a
andb
that depend onallocator-api2
.a
does not enable the nightly feature,b
does. Now a project that contains botha
andb
will fail to compile, asb
turning on the feature flag will also turn it on fora
, buta
does not contain#![feature(allocator_api)]
.This does actually happen in the real world in a large complicated project which ends up depending on hashbrown twice: rust-lang/hashbrown#564. But as more and more crates start using
allocator-api2
you don't even need such a complicated scenario.The text was updated successfully, but these errors were encountered: