diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-06-13 14:51:56 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-06-13 14:51:56 +0200 |
| commit | ca06f8896b62c58fe366bdecf2c237d8a195fd0f (patch) | |
| tree | b5e501c69e7276b2ec9319075ce9ec2417996565 /src/libstd/macros.rs | |
| parent | a0d05150c9f3297d558262e5637521d08f86d8de (diff) | |
| parent | 8eb7f36a3ba06dbea4a44254c3e2d92455ae150f (diff) | |
| download | rust-ca06f8896b62c58fe366bdecf2c237d8a195fd0f.tar.gz rust-ca06f8896b62c58fe366bdecf2c237d8a195fd0f.zip | |
Rollup merge of #61720 - alexcrichton:libstd-cfg-if-dep, r=sfackler
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 ef1b549d1dc..d695141bef0 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)* - } -} |
