From 770b6e2fc2f8749466487e4c2ae031b8ceecae04 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Fri, 14 Mar 2014 10:29:13 -0700 Subject: rustc: Fix cfg(not(a, b)) to be not(a && b) Previously, the cfg attribute `cfg(not(a, b))` was translated to `(!a && !b)`, but this isn't very useful because that can already be expressed as `cfg(not(a), not(b))`. This commit changes the translation to `!(a && b)` which is more symmetrical of the rest of the `cfg` attribute. Put another way, I would expect `cfg(clause)` to be the opposite of `cfg(not(clause))`, but this is not currently the case with multiple element clauses. --- src/libsyntax/attr.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/libsyntax') diff --git a/src/libsyntax/attr.rs b/src/libsyntax/attr.rs index ed56ef15a1c..7ff9a73f29d 100644 --- a/src/libsyntax/attr.rs +++ b/src/libsyntax/attr.rs @@ -317,9 +317,9 @@ pub fn test_cfg> debug!("not!"); // inside #[cfg(not(...))], so these need to all // not match. - not_cfgs.iter().all(|mi| { + !not_cfgs.iter().all(|mi| { debug!("cfg(not({}[...]))", mi.name()); - !contains(cfg, *mi) + contains(cfg, *mi) }) } _ => contains(cfg, *cfg_mi) -- cgit 1.4.1-3-g733a5