From 5d514b6c6afc728a9b4a4c78c84b169e9f53022a Mon Sep 17 00:00:00 2001 From: Sebastian Wicki Date: Sat, 27 Feb 2016 20:54:45 +0100 Subject: [PATCH] Fix evaluation order of the cfg_if! macro Since #[cfg] attributes are short-circuting, cfg_if! should not change the order in which the predicates are listed. This enables the use of unstable cfg attributes in cfg_if!, which is useful when building libstd. --- src/macros.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/macros.rs b/src/macros.rs index 3c2978ea..5811c84c 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -23,7 +23,7 @@ macro_rules! cfg_if { macro_rules! __cfg_if_items { (($($not:meta,)*) ; ) => {}; (($($not:meta,)*) ; ( ($($m:meta),*) ($($it:item)*) ), $($rest:tt)*) => { - __cfg_if_apply! { cfg(all($($m,)* not(any($($not),*)))), $($it)* } + __cfg_if_apply! { cfg(all(not(any($($not),*)), $($m,)*)), $($it)* } __cfg_if_items! { ($($not,)* $($m,)*) ; $($rest)* } } }