Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upBlocks for items #1991
Comments
This comment has been minimized.
This comment has been minimized.
|
With https://github.com/alexcrichton/cfg-if you can make it look like: #[macro_use] extern crate cfg_if;
cfg_if! {
if #[cfg(feature = "abc")] {
extern crate x;
extern crate y;
mod z;
use z::{a, b, c};
}
} |
withoutboats
added
the
T-lang
label
May 14, 2017
This comment has been minimized.
This comment has been minimized.
|
@withoutboats Would anonymous modules do this? As something like #[cfg(feature = "abc")]
mod {
extern crate x;
extern crate y;
mod z;
use z::{a, b, c};
} |
This comment has been minimized.
This comment has been minimized.
|
I considered anonymous modules, but the main issue is that things like |
This comment has been minimized.
This comment has been minimized.
|
@clarcharr it's actually a pattern, albeit an uncommon one, to put extern crates in submodules. |
This comment has been minimized.
This comment has been minimized.
|
@ubsan wait, is that actually allowed? huh. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
I think this is #2377 so I'm closing in favor of that. |
Centril
closed this
Apr 26, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
clarfon commentedMay 5, 2017
It'd be really nice if we could do something like:
Right now, we have to attach the attribute to every item, which is a bit redundant. We can put things in a module and then re-export them, but it'd be nice if we could do something like this instead.