X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Flibrustc_parse%2Fconfig.rs;h=1bf6e9ecbc060ec8868bd2bff9134b71c8ef8817;hb=1a496f33796d848609e06604445e28056954f412;hp=7ce555ed57a3d0dc9552700e7e0d3008bb3f89fe;hpb=9b0427fc943490fd0065c656afd185a219b672c4;p=rust.git diff --git a/src/librustc_parse/config.rs b/src/librustc_parse/config.rs index 7ce555ed57a..1bf6e9ecbc0 100644 --- a/src/librustc_parse/config.rs +++ b/src/librustc_parse/config.rs @@ -9,14 +9,9 @@ //! [#64197]: https://github.com/rust-lang/rust/issues/64197 use crate::validate_attr; +use rustc_feature::Features; use syntax::attr::HasAttrs; -use syntax::feature_gate::{ - feature_err, - EXPLAIN_STMT_ATTR_SYNTAX, - Features, - get_features, - GateIssue, -}; +use syntax::feature_gate::{feature_err, get_features}; use syntax::attr; use syntax::ast; use syntax::edition::Edition; @@ -52,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); @@ -106,7 +101,7 @@ fn process_cfg_attr(&mut self, attr: ast::Attribute) -> Vec { 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, @@ -217,8 +212,7 @@ 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, - EXPLAIN_STMT_ATTR_SYNTAX); + "attributes on expressions are experimental"); if attr.is_doc_comment() { err.help("`///` is for documentation comments. For a plain comment, use `//`.");