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/libpanic_unwind | |
| 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/libpanic_unwind')
| -rw-r--r-- | src/libpanic_unwind/Cargo.toml | 1 | ||||
| -rw-r--r-- | src/libpanic_unwind/lib.rs | 5 | ||||
| -rw-r--r-- | src/libpanic_unwind/macros.rs | 35 |
3 files changed, 2 insertions, 39 deletions
diff --git a/src/libpanic_unwind/Cargo.toml b/src/libpanic_unwind/Cargo.toml index 1b3901ac11a..47cd09f1b05 100644 --- a/src/libpanic_unwind/Cargo.toml +++ b/src/libpanic_unwind/Cargo.toml @@ -16,3 +16,4 @@ core = { path = "../libcore" } libc = { version = "0.2", default-features = false } unwind = { path = "../libunwind" } compiler_builtins = "0.1.0" +cfg-if = "0.1.8" diff --git a/src/libpanic_unwind/lib.rs b/src/libpanic_unwind/lib.rs index 72ddafb420c..2bb9ce6ab22 100644 --- a/src/libpanic_unwind/lib.rs +++ b/src/libpanic_unwind/lib.rs @@ -38,10 +38,7 @@ use core::mem; use core::raw; use core::panic::BoxMeUp; -#[macro_use] -mod macros; - -cfg_if! { +cfg_if::cfg_if! { if #[cfg(target_os = "emscripten")] { #[path = "emcc.rs"] mod imp; diff --git a/src/libpanic_unwind/macros.rs b/src/libpanic_unwind/macros.rs deleted file mode 100644 index 659e977285e..00000000000 --- a/src/libpanic_unwind/macros.rs +++ /dev/null @@ -1,35 +0,0 @@ -/// A macro for defining `#[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)* - } -} |
