-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
#[cfg_attr] #1242
Comments
Btw, this is useful for linkage flags on native mods specifically. |
It will also replace the #[ignore(cfg(...))] syntax with #[cfg_attr(..., ignore)] |
What does #[ignore(cfg(...))] actually do?... |
Marks a test as ignored when compiling with a matching configuration. |
Thought about generalizing this. See here: https://github.com/graydon/rust/wiki/Rust-Attributes-Preprocessing-Proposal Maybe a new issue should be opened? I'll give it a shot and pull later anyhow. |
Reopening because this is a useful idea independently of any possibly attribute overhaul, and much smaller in scope. |
Beyond the concrete proposal I wonder how to access these in the compiler, config seems not very extensible. Ideally, one would be able to go from ast node to next enclosing ast node with an attached attribute but i dont see how to do this without a lot of extra book keeping. (would like this for easier addition of compiler-level, pragma-like attributes) |
I am warming to the more-general attribute processing proposal, given a little time spent working with attributes in production code. An interested party could make this work. |
Well, I can try to throw together a demo interpreter for roughly what I'm thinking today to solidify how it could/should work. My initial proposal has some issues I'd like to think out, and it'll need to be redone in many areas I think. For instance, predicates for use here could really be any pure predicate you could use in the typestate system. |
I think this is now officially a dupe of #2119 and there's action there and none here, so closing this one. |
* Now gen-c display the c file instead of the goto binnary. Co-authored-by: Jérôme Dubois <jerome.dubois24@gmail.com>
[cfg_attr] is a theoretical tag for conditional use of an attribute based on target.
For example:
On OS X this expands to
On Linux is expands to
This would probably be eventually replaced by a more powerful meta-item system. I'm thinking along the lines of cmake?
The text was updated successfully, but these errors were encountered: