-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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 with path
attribute
#25544
Comments
Yeah, |
x11/src/lib.rs and x11-dl/src/lib.rs are most duplicates of each other. It would be preferable to combine them into a single file. This could be done by building src/lib.rs with different config attributes (eg. cfg=dynamic) but at present it doesn't look like it is possible to have different exports depending on #[cfg(attribute)] See rust-lang/rust#25544
A similar issue is found with conditional including of modules. Consider the program: #[cfg(test)]
mod fake;
fn main() {
println!("testing");
} This should only fail to compile in test mode, instead we see:
Interactive repro here. |
We should totally move Also, we might want to avoid loading and parsing a module if we see |
I didn't get to this before the beta. |
@eddyb yeah, I was plannning on doing cfg processing after parsing during expansion, but it looks like this will require at least some cfg processing during parsing. I like the idea of not loading or parsing an unconfigured module, but that will probably need more discussion. |
Support `cfg_attr` on `path` attributes Fixes #25544. This is technically a [breaking-change]. For example, the following would break: ```rust mod foo; // Suppose `foo.rs` existed in the appropriate location ```
Heads up: #35584 |
This occurs because
#[cfg_attr]
is processed at phase 2 (configure and expand) but#[path]
is done at phase 1 (parse).The text was updated successfully, but these errors were encountered: