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.
This commit is contained in:
Sebastian Wicki 2016-02-27 20:54:45 +01:00
parent b7c3e5c026
commit 5d514b6c6a
1 changed files with 1 additions and 1 deletions

View File

@ -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)* }
}
}