about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2014-10-27 09:07:44 -0700
committerAlex Crichton <alex@alexcrichton.com>2014-10-27 15:12:30 -0700
commit650214b17094d9ae97f59bd6e0fa62dc19add521 (patch)
treee5afdf711aa726f3fadcf696b056cf9fe2552aa8 /src/libsyntax
parentf1118cc084fef5d3a07d9672c2c952a266195963 (diff)
parent9acce10fe7f3103dc1e65168e956fe0e53bca117 (diff)
downloadrust-650214b17094d9ae97f59bd6e0fa62dc19add521.tar.gz
rust-650214b17094d9ae97f59bd6e0fa62dc19add521.zip
rollup merge of #18326 : sfackler/cfg-final
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/config.rs22
1 files changed, 5 insertions, 17 deletions
diff --git a/src/libsyntax/config.rs b/src/libsyntax/config.rs
index 8824a937038..72c62a173fc 100644
--- a/src/libsyntax/config.rs
+++ b/src/libsyntax/config.rs
@@ -250,30 +250,18 @@ fn impl_item_in_cfg(cx: &mut Context, impl_item: &ast::ImplItem) -> bool {
 // Determine if an item should be translated in the current crate
 // configuration based on the item's attributes
 fn in_cfg(diagnostic: &SpanHandler, cfg: &[P<ast::MetaItem>], attrs: &[ast::Attribute]) -> bool {
-    let mut in_cfg = false;
-    let mut seen_cfg = false;
-    for attr in attrs.iter() {
+    attrs.iter().all(|attr| {
         let mis = match attr.node.value.node {
             ast::MetaList(_, ref mis) if attr.check_name("cfg") => mis,
-            _ => continue
+            _ => return true
         };
 
         if mis.len() != 1 {
             diagnostic.span_err(attr.span, "expected 1 cfg-pattern");
-            return false;
+            return true;
         }
 
-        if seen_cfg {
-            diagnostic.span_err(attr.span, "The semantics of multiple `#[cfg(..)]` attributes on \
-                                            same item are changing from the union of the cfgs to \
-                                            the intersection of the cfgs. Change `#[cfg(a)] \
-                                            #[cfg(b)]` to `#[cfg(any(a, b))]`.");
-            return false;
-        }
-
-        seen_cfg = true;
-        in_cfg |= attr::cfg_matches(diagnostic, cfg, &*mis[0]);
-    }
-    in_cfg | !seen_cfg
+        attr::cfg_matches(diagnostic, cfg, &*mis[0])
+    })
 }