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

Support nested cfg_attr attributes #34216

Merged
merged 1 commit into from
Jun 16, 2016
Merged

Conversation

jseyfried
Copy link
Contributor

Support arbitrarily deeply nested cfg_attr attributes (e.g. #[cfg_attr(foo, cfg_attr(bar, baz))]).
This makes configuration idempotent.

Currently, the nighties do not support any cfg_attr nesting. Stable and beta support just one level of cfg_attr nesting (expect for attributes on macro-expanded nodes, where no nesting is supported).

This is a [breaking-change]. For example, the following would break:

macro_rules! m { () => {
    #[cfg_attr(all(), cfg_attr(all(), cfg(foo)))]
    fn f() {}
} }
m!();

fn main() { f() } //~ ERROR unresolved name `f`

r? @nrc

@nrc
Copy link
Member

nrc commented Jun 16, 2016

cc @cgswords

@nrc
Copy link
Member

nrc commented Jun 16, 2016

@bors: r+

@bors
Copy link
Contributor

bors commented Jun 16, 2016

📌 Commit 65d256e has been approved by nrc

@bors
Copy link
Contributor

bors commented Jun 16, 2016

⌛ Testing commit 65d256e with merge 6edea2c...

bors added a commit that referenced this pull request Jun 16, 2016
Support nested `cfg_attr` attributes

Support arbitrarily deeply nested `cfg_attr` attributes (e.g. `#[cfg_attr(foo, cfg_attr(bar, baz))]`).
This makes configuration idempotent.

Currently, the nighties do not support any `cfg_attr` nesting. Stable and beta support just one level of `cfg_attr` nesting (expect for attributes on macro-expanded nodes, where no nesting is supported).

This is a [breaking-change]. For example, the following would break:
```rust
macro_rules! m { () => {
    #[cfg_attr(all(), cfg_attr(all(), cfg(foo)))]
    fn f() {}
} }
m!();

fn main() { f() } //~ ERROR unresolved name `f`
```
r? @nrc
@bors bors merged commit 65d256e into rust-lang:master Jun 16, 2016
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

Successfully merging this pull request may close these issues.

3 participants