-
Notifications
You must be signed in to change notification settings - Fork 13k
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 doesn't work in all contexts #19372
Labels
A-syntaxext
Area: Syntax extensions
Comments
Not entirely. It's still not going to handle attributes on patterns, fields, or variants AFAIKT. |
kmcallister
added a commit
to kmcallister/rust
that referenced
this issue
Feb 9, 2015
alexcrichton
added a commit
to alexcrichton/rust
that referenced
this issue
Feb 10, 2015
This doesn't appear to be fixed when cfg_attr is used inside of a macro: macro_rules! borked {
() => {
#[derive(Debug)] pub struct Good;
#[cfg_attr(not(test), derive(Debug))] pub struct Bad;
}
}
borked!();
fn main() {
println!("{:?}", Good);
println!("{:?}", Bad);
} (via curmet @ IRC) |
Thanks, I've opened #22250 about that issue. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It's implemented as a syntax extension, so it only works when attached to an item. It should really be folded into the strip_cfg pass until syntax extensions are powerful enough to handle all the cases.
The text was updated successfully, but these errors were encountered: