]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc_parse/config.rs
syntax: Use `ast::MacArgs` for attributes
[rust.git] / src / librustc_parse / config.rs
index dde320aed219f01556a553fcb2985cce0275f6df..1bf6e9ecbc060ec8868bd2bff9134b71c8ef8817 100644 (file)
@@ -11,7 +11,7 @@
 use crate::validate_attr;
 use rustc_feature::Features;
 use syntax::attr::HasAttrs;
-use syntax::feature_gate::{feature_err, get_features, GateIssue};
+use syntax::feature_gate::{feature_err, get_features};
 use syntax::attr;
 use syntax::ast;
 use syntax::edition::Edition;
@@ -47,7 +47,7 @@ pub fn features(mut krate: ast::Crate, sess: &ParseSess, edition: Edition,
         } else { // the entire crate is unconfigured
             krate.attrs = Vec::new();
             krate.module.items = Vec::new();
-            return (krate, Features::new());
+            return (krate, Features::default());
         }
 
         features = get_features(&sess.span_diagnostic, &krate.attrs, edition, allow_features);
@@ -101,7 +101,7 @@ fn process_cfg_attr(&mut self, attr: ast::Attribute) -> Vec<ast::Attribute> {
         if !attr.has_name(sym::cfg_attr) {
             return vec![attr];
         }
-        if attr.get_normal_item().tokens.is_empty() {
+        if let ast::MacArgs::Empty = attr.get_normal_item().args {
             self.sess.span_diagnostic
                 .struct_span_err(
                     attr.span,
@@ -212,7 +212,6 @@ pub fn maybe_emit_expr_attr_err(&self, attr: &ast::Attribute) {
             let mut err = feature_err(self.sess,
                                       sym::stmt_expr_attributes,
                                       attr.span,
-                                      GateIssue::Language,
                                       "attributes on expressions are experimental");
 
             if attr.is_doc_comment() {