diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2019-06-10 08:12:14 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2019-06-10 10:58:44 -0700 |
| commit | 8eb7f36a3ba06dbea4a44254c3e2d92455ae150f (patch) | |
| tree | 713fd6d6cc498ca34a5292d574981b9240c1cc5f /src/libstd/macros.rs | |
| parent | a73ecb3d9c432f8f53117b1a6b6c209dc802dee7 (diff) | |
std: Remove internal definitions of `cfg_if!` macro
This is duplicated in a few locations throughout the sysroot to work around issues with not exporting a macro in libstd but still wanting it available to sysroot crates to define blocks. Nowadays though we can simply depend on the `cfg-if` crate on crates.io, allowing us to use it from there!
Diffstat (limited to 'src/libstd/macros.rs')
| -rw-r--r-- | src/libstd/macros.rs | 36 |
1 files changed, 0 insertions, 36 deletions
diff --git a/src/libstd/macros.rs b/src/libstd/macros.rs index ef7179f0b6f..92b9a16f3e3 100644 --- a/src/libstd/macros.rs +++ b/src/libstd/macros.rs @@ -896,39 +896,3 @@ mod builtin { ($cond:expr, $($arg:tt)+) => ({ /* compiler built-in */ }); } } - -/// Defines `#[cfg]` if-else statements. -/// -/// This is similar to the `if/elif` C preprocessor macro by allowing definition -/// of a cascade of `#[cfg]` cases, emitting the implementation which matches -/// first. -/// -/// This allows you to conveniently provide a long list `#[cfg]`'d blocks of code -/// without having to rewrite each clause multiple times. -macro_rules! cfg_if { - ($( - if #[cfg($($meta:meta),*)] { $($it:item)* } - ) else * else { - $($it2:item)* - }) => { - __cfg_if_items! { - () ; - $( ( ($($meta),*) ($($it)*) ), )* - ( () ($($it2)*) ), - } - } -} - -macro_rules! __cfg_if_items { - (($($not:meta,)*) ; ) => {}; - (($($not:meta,)*) ; ( ($($m:meta),*) ($($it:item)*) ), $($rest:tt)*) => { - __cfg_if_apply! { cfg(all(not(any($($not),*)), $($m,)*)), $($it)* } - __cfg_if_items! { ($($not,)* $($m,)*) ; $($rest)* } - } -} - -macro_rules! __cfg_if_apply { - ($m:meta, $($it:item)*) => { - $(#[$m] $it)* - } -} |
