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

Paths in cfg_attr should be honored #3

Open
TedDriggs opened this issue Feb 14, 2019 · 0 comments
Open

Paths in cfg_attr should be honored #3

TedDriggs opened this issue Feb 14, 2019 · 0 comments

Comments

@TedDriggs
Copy link
Owner

Consider the following example from dtolnay/request-for-implementation#6

r#"
#[cfg(feature = "m1")]
mod m1;

#[cfg_attr(feature = "m2", path = "m2.rs")]
#[cfg_attr(not(feature = "m2"), path = "empty.rs")]
mod placeholder;

According to that ticket, this should expand to two declarations of mod placeholder, with the cfg_attr being converted to a normal cfg attribute.

I'm not sure this is worth the complexity it creates. Consider the following case:

#[cfg_attr(feature = "foo", path = "m2")]
#[cfg_attr(not(feature = "foo"), path = "m3")]
mod outer {
    #[cfg_attr(feature = "foo", path = "baz.rs")]
    #[cfg_attr(not(feature = "foo"), path = "bar.rs")]
    mod placeholder;
}

We'd need to emit outer twice, with placeholder twice inside.

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

No branches or pull requests

1 participant