Skip to content

allow module-level feature flags #9988

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

Closed
thestinger opened this issue Oct 21, 2013 · 3 comments
Closed

allow module-level feature flags #9988

thestinger opened this issue Oct 21, 2013 · 3 comments
Labels
A-frontend Area: Compiler frontend (errors, parsing and HIR)

Comments

@thestinger
Copy link
Contributor

You may want to use an experimental feature in an isolate module without allowing it to infect the entire crate. This is also currently needed for rust-core to use macros, because until we have both static linking and whole program optimization it's going to be a module.

@alexcrichton
Copy link
Member

We had originally explicitly decided to not have module-level control over the feature set, but that decision didn't really have a reason other than "it feels right".

One thing to consider with module-level control is whether modules should the have the ability to deny features? Do we want something like #[feature(+feature1, -feature2)]? I don't think we'd want to do that, but I can imagine that someone will at some point want to do that.

@huonw
Copy link
Member

huonw commented Nov 21, 2014

We still don't have the ability for this. It's possibly useful in terms of restricting which parts of a the crate are experimental (e.g. I could imagine most of a crate being stable, with certain parts pushing the boundaries of the type system etc. with feature flags). On the note of infection, rust-lang/rfcs#475 means these will be forced to infect the entire crate with only-usable-with-nightly-itis.

@alexcrichton
Copy link
Member

Quite a bit of time has passed since this was opened, and with the current design of feature gates it's intentional that it's only crate-level, so closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-frontend Area: Compiler frontend (errors, parsing and HIR)
Projects
None yet
Development

No branches or pull requests

3 participants