pub fn in_cfg(&self, attrs: &[Attribute]) -> bool {
        attrs.iter().all(|attr| {
            if !is_cfg(attr) {
                return true;
            }

            let error = |span, msg, suggestion: &str| {
                let mut err = self.sess.span_diagnostic.struct_span_err(span, msg);
                if !suggestion.is_empty() {
                    err.span_suggestion(
                        span,
                        "expected syntax is",
                        suggestion.into(),
                        Applicability::MaybeIncorrect,
                    );
                }
                err.emit();
                true
            };

            let meta_item = match validate_attr::parse_meta(self.sess, attr) {
                Ok(meta_item) => meta_item,
                Err(mut err) => { err.emit(); return true; }
            };
            let nested_meta_items = if let Some(nested_meta_items) = meta_item.meta_item_list() {
                nested_meta_items
            } else {
                return error(meta_item.span, "`cfg` is not followed by parentheses",
                                             "cfg(/* predicate */)");
            };

            if nested_meta_items.is_empty() {
                return error(meta_item.span, "`cfg` predicate is not specified", "");
            } else if nested_meta_items.len() > 1 {
                return error(nested_meta_items.last().unwrap().span(),
                             "multiple `cfg` predicates are specified", "");
            }

            match nested_meta_items[0].meta_item() {
                Some(meta_item) => attr::cfg_matches(meta_item, self.sess, self.features),
                None => error(nested_meta_items[0].span(),
                              "`cfg` predicate key cannot be a literal", ""),
            }
        })
    }
/// Determines if a node with the given attributes should be included in this configuration.
Determines if a node with the given attributes should be included in this configuration.
Determines if a node with the given attributes should be included in this configuration .
pub fn in_cfg(&self, attrs: &[Attribute]) -> bool {
        attrs.iter().all(|attr| {
            if !is_cfg(attr) {
                return true;
            }
            let error = |span, msg, suggestion: &str| {
                let mut err = self.sess.span_diagnostic.struct_span_err(span, msg);
                if !suggestion.is_empty() {
                    err.span_suggestion(
                        span,
                        "expected syntax is",
                        suggestion.into(),
                        Applicability::MaybeIncorrect,
                    );
                }
                err.emit();
                true
            };
            let meta_item = match validate_attr::parse_meta(self.sess, attr) {
                Ok(meta_item) => meta_item,
                Err(mut err) => { err.emit(); return true; }
            };
            let nested_meta_items = if let Some(nested_meta_items) = meta_item.meta_item_list() {
                nested_meta_items
            } else {
                return error(meta_item.span, "`cfg` is not followed by parentheses",
                                             "cfg(/* predicate */)");
            };
            if nested_meta_items.is_empty() {
                return error(meta_item.span, "`cfg` predicate is not specified", "");
            } else if nested_meta_items.len() > 1 {
                return error(nested_meta_items.last().unwrap().span(),
                             "multiple `cfg` predicates are specified", "");
            }
            match nested_meta_items[0].meta_item() {
                Some(meta_item) => attr::cfg_matches(meta_item, self.sess, self.features),
                None => error(nested_meta_items[0].span(),
                              "`cfg` predicate key cannot be a literal", ""),
            }
        })
    }
pub fn in_cfg ( & self , attrs : & [ Attribute ] ) -> bool { attrs . iter ( ) . all ( | attr | { if ! is_cfg ( attr ) { return true ; } let error = | span , msg , suggestion : & str | { let mut err = self . sess . span_diagnostic . struct_span_err ( span , msg ) ; if ! suggestion . is_empty ( ) { err . span_suggestion ( span , " " , suggestion . into ( ) , Applicability :: MaybeIncorrect , ) ; } err . emit ( ) ; true } ; let meta_item = match validate_attr :: parse_meta ( self . sess , attr ) { Ok ( meta_item ) => meta_item , Err ( mut err ) => { err . emit ( ) ; return true ; } } ; let nested_meta_items = if let Some ( nested_meta_items ) = meta_item . meta_item_list ( ) { nested_meta_items } else { return error ( meta_item . span , " " , " " ) ; } ; if nested_meta_items . is_empty ( ) { return error ( meta_item . span , " " , " " ) ; } else if nested_meta_items . len ( ) > 1 { return error ( nested_meta_items . last ( ) . unwrap ( ) . span ( ) , " " , " " ) ; } match nested_meta_items [ 0 ] . meta_item ( ) { Some ( meta_item ) => attr :: cfg_matches ( meta_item , self . sess , self . features ) , None => error ( nested_meta_items [ 0 ] . span ( ) , " " , " " ) , } } ) }
Determines if a node with the given attributes should be included in this configuration.
Determines if a node with the given attributes should be included in this configuration .
&self
attrs
&[Attribute]