]> git.lizzy.rs Git - rust.git/commitdiff
make it compile again
authorflip1995 <uwdkn@student.kit.edu>
Tue, 17 Apr 2018 13:33:39 +0000 (15:33 +0200)
committerflip1995 <uwdkn@student.kit.edu>
Wed, 2 May 2018 10:05:13 +0000 (12:05 +0200)
20 files changed:
src/librustc/hir/check_attr.rs
src/librustc/ich/impls_syntax.rs
src/librustc/lint/levels.rs
src/librustc/session/config.rs
src/librustc/traits/on_unimplemented.rs
src/librustc_driver/lib.rs
src/librustc_incremental/assert_dep_graph.rs
src/librustc_resolve/build_reduced_graph.rs
src/librustdoc/clean/cfg.rs
src/librustdoc/html/render.rs
src/libsyntax/ast.rs
src/libsyntax/attr.rs
src/libsyntax/ext/expand.rs
src/libsyntax/feature_gate.rs
src/libsyntax/parse/attr.rs
src/libsyntax/parse/parser.rs
src/libsyntax/print/pprust.rs
src/test/compile-fail/unknown-tool-name.rs
src/test/compile-fail/unknown_tool_attributes-1.rs
src/test/ui/feature-gate-tool_attributes.stderr

index e8bdb9d5d5f6216d91b88f46b543996d6b42e3ba..24a1256c9d35bdf16bdaccd11a99c563f1a99f33 100644 (file)
@@ -308,7 +308,7 @@ fn check_expr_attributes(&self, expr: &hir::Expr) {
 
     fn check_used(&self, item: &hir::Item, target: Target) {
         for attr in &item.attrs {
-            if attr.name().map(|name| name == "used").unwrap_or(false) && target != Target::Static {
+            if attr.name() == "used" && target != Target::Static {
                 self.tcx.sess
                     .span_err(attr.span, "attribute must be applied to a `static` variable");
             }
index d90dba2ff0495b5a21d6ebfe41a811d0ff8d2089..1cf9b7bf4780e785a8a2b52a4035201fc7e465ce 100644 (file)
@@ -216,7 +216,7 @@ fn hash_stable<W: StableHasherResult>(&self,
                                           hasher: &mut StableHasher<W>) {
         self.segments.len().hash_stable(hcx, hasher);
         for segment in &self.segments {
-            segment.identifier.name.hash_stable(hcx, hasher);
+            segment.ident.name.hash_stable(hcx, hasher);
         }
     }
 }
index 0eeb0cf6c3705dbf39281cd781f9fa366c937140..d158f52c643ceca2c2896acabe6c8cf02bd21add 100644 (file)
@@ -221,7 +221,7 @@ pub fn push(&mut self, attrs: &[ast::Attribute]) -> BuilderPush {
                         continue
                     }
                 };
-                let name = word.ident.name;
+                let name = word.name();
                 match store.check_lint_name(&name.as_str()) {
                     CheckLintNameResult::Ok(ids) => {
                         let src = LintSource::Node(name, li.span);
@@ -260,7 +260,7 @@ pub fn push(&mut self, attrs: &[ast::Attribute]) -> BuilderPush {
                                                 Some(li.span.into()),
                                                 &msg);
                         if name.as_str().chars().any(|c| c.is_uppercase()) {
-                            let name_lower = name.as_str().to_lowercase();
+                            let name_lower = name.as_str().to_lowercase().to_string();
                             if let CheckLintNameResult::NoLint =
                                     store.check_lint_name(&name_lower) {
                                 db.emit();
index 59b40e9e2dc56b489ed986e1a0d54c45f4824394..dc97c941567059cd5912250a945af3fdc4f0e938 100644 (file)
@@ -1683,7 +1683,7 @@ pub fn parse_cfgspecs(cfgspecs: Vec<String>) -> ast::CrateConfig {
                 early_error(ErrorOutputType::default(), &msg)
             }
 
-            (meta_item.ident.name, meta_item.value_str())
+            (meta_item.name(), meta_item.value_str())
         })
         .collect::<ast::CrateConfig>()
 }
index d1fd70ae02d6987b4ec5170570259079822a9367..3cf7af30b3d551a0442f509f2a5279f2494cd5a3 100644 (file)
@@ -190,7 +190,7 @@ pub fn evaluate(&self,
         for command in self.subcommands.iter().chain(Some(self)).rev() {
             if let Some(ref condition) = command.condition {
                 if !attr::eval_condition(condition, &tcx.sess.parse_sess, &mut |c| {
-                    options.contains(&(c.ident.name.as_str().to_string(),
+                    options.contains(&(c.name().as_str().to_string(),
                                       match c.value_str().map(|s| s.as_str().to_string()) {
                                           Some(s) => Some(s),
                                           None => None
index 67ba55a6aabd2e66c83f3651777cbcbcd41b13a1..a1052ca6c3ca9520fc7cf8f4e38ebc106f8263a7 100644 (file)
@@ -1060,7 +1060,7 @@ fn print_crate_info(trans: &TransCrate,
                     let mut cfgs = Vec::new();
                     for &(name, ref value) in sess.parse_sess.config.iter() {
                         let gated_cfg = GatedCfg::gate(&ast::MetaItem {
-                            name: ast::Path::from_ident(DUMMY_SP, name.to_ident()),
+                            ident: ast::Path::from_ident(name.to_ident()),
                             node: ast::MetaItemKind::Word,
                             span: DUMMY_SP,
                         });
index 57311a7b588a049fdf3580c25ae63503475fa286..38e891008f7308c073fb30b82c976418a4760b4e 100644 (file)
@@ -110,7 +110,7 @@ fn argument(&self, attr: &ast::Attribute) -> Option<ast::Name> {
         for list_item in attr.meta_item_list().unwrap_or_default() {
             match list_item.word() {
                 Some(word) if value.is_none() =>
-                    value = Some(word.ident.name),
+                    value = Some(word.name()),
                 _ =>
                     // FIXME better-encapsulate meta_item (don't directly access `node`)
                     span_bug!(list_item.span(), "unexpected meta-item {:?}", list_item.node),
index e5e6c22c7a2963056e1b6ef9fdf28ca9bdf9a834..4522a0b8624301fcdd426248107c82e187119c56 100644 (file)
@@ -702,7 +702,7 @@ fn legacy_macro_imports(&mut self, attrs: &[ast::Attribute]) -> LegacyMacroImpor
                 match attr.meta_item_list() {
                     Some(names) => for attr in names {
                         if let Some(word) = attr.word() {
-                            imports.imports.push((word.ident.name, attr.span()));
+                            imports.imports.push((word.name(), attr.span()));
                         } else {
                             span_err!(self.session, attr.span(), E0466, "bad macro import");
                         }
index f8cd6ebc4645bc24f68e5338e379b3469098e9ca..d5e0f95ddf4356ac3396314dc6614889c9095418 100644 (file)
@@ -438,7 +438,7 @@ fn name_value_cfg(name: &str, value: &str) -> Cfg {
 
     fn dummy_meta_item_word(name: &str) -> MetaItem {
         MetaItem {
-            name: Path::from_ident(DUMMY_SP, Ident::from_str(name)),
+            ident: Path::from_ident(Ident::from_str(name)),
             node: MetaItemKind::Word,
             span: DUMMY_SP,
         }
@@ -447,7 +447,7 @@ fn dummy_meta_item_word(name: &str) -> MetaItem {
     macro_rules! dummy_meta_item_list {
         ($name:ident, [$($list:ident),* $(,)*]) => {
             MetaItem {
-                name: Path::from_ident(DUMMY_SP, Ident::from_str(stringify!($name))),
+                ident: Path::from_ident(Ident::from_str(stringify!($name))),
                 node: MetaItemKind::List(vec![
                     $(
                         dummy_spanned(NestedMetaItemKind::MetaItem(
@@ -461,7 +461,7 @@ macro_rules! dummy_meta_item_list {
 
         ($name:ident, [$($list:expr),* $(,)*]) => {
             MetaItem {
-                name: Path::from_ident(DUMMY_SP, Ident::from_str(stringify!($name))),
+                ident: Path::from_ident(Ident::from_str(stringify!($name))),
                 node: MetaItemKind::List(vec![
                     $(
                         dummy_spanned(NestedMetaItemKind::MetaItem($list)),
@@ -601,7 +601,7 @@ fn test_parse_ok() {
             assert_eq!(Cfg::parse(&mi), Ok(word_cfg("all")));
 
             let mi = MetaItem {
-                name: Path::from_ident(DUMMY_SP, Ident::from_str("all")),
+                ident: Path::from_ident(Ident::from_str("all")),
                 node: MetaItemKind::NameValue(dummy_spanned(LitKind::Str(
                     Symbol::intern("done"),
                     StrStyle::Cooked,
@@ -636,7 +636,7 @@ fn test_parse_ok() {
     fn test_parse_err() {
         with_globals(|| {
             let mi = MetaItem {
-                name: Path::from_ident(DUMMY_SP, Ident::from_str("foo")),
+                ident: Path::from_ident(Ident::from_str("foo")),
                 node: MetaItemKind::NameValue(dummy_spanned(LitKind::Bool(false))),
                 span: DUMMY_SP,
             };
index 9248210c2691be15c97b5190b2b9611134e63335..e9520573f8bd6dca32321b0e4275ee9c1d9f6a6c 100644 (file)
@@ -3284,7 +3284,7 @@ fn item_enum(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
 }
 
 fn render_attribute(attr: &ast::MetaItem) -> Option<String> {
-    let name = attr.ident.name;
+    let name = attr.name();
 
     if attr.is_word() {
         Some(format!("{}", name))
index bc457f49fcffda325941eeae5760eb4f77818114..f8cd6103bdfa110e4e421ba0e5c129b1b2f4115c 100644 (file)
@@ -477,7 +477,7 @@ pub enum NestedMetaItemKind {
 /// E.g. `#[test]`, `#[derive(..)]`, `#[rustfmt::skip]` or `#[feature = "foo"]`
 #[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)]
 pub struct MetaItem {
-    pub name: Path,
+    pub ident: Path,
     pub node: MetaItemKind,
     pub span: Span,
 }
index 8fa5f55490e3aa3ea3038591ec9b00ccae55d1a2..82e04ff32ca98a3d300e074b0b01ecf9ffe3026a 100644 (file)
@@ -18,7 +18,7 @@
 use ast::{AttrId, Attribute, Name, Ident};
 use ast::{MetaItem, MetaItemKind, NestedMetaItem, NestedMetaItemKind};
 use ast::{Lit, LitKind, Expr, ExprKind, Item, Local, Stmt, StmtKind};
-use codemap::{Spanned, respan, dummy_spanned};
+use codemap::{BytePos, Spanned, respan, dummy_spanned};
 use syntax_pos::Span;
 use errors::Handler;
 use feature_gate::{Features, GatedCfg};
@@ -111,7 +111,7 @@ pub fn is_known(attr: &Attribute) -> bool {
 
 pub fn is_known_tool(attr: &Attribute) -> bool {
     let tool_name =
-        attr.path.segments.iter().next().expect("empty path in attribute").identifier.name;
+        attr.path.segments.iter().next().expect("empty path in attribute").ident.name;
     RUST_KNOWN_TOOL.contains(&tool_name.as_str().as_ref())
 }
 
@@ -213,7 +213,7 @@ pub fn is_meta_item_list(&self) -> bool {
 }
 
 fn name_from_path(path: &ast::Path) -> Name {
-    path.segments.last().expect("empty path in attribute").identifier.name
+    path.segments.last().expect("empty path in attribute").ident.name
 }
 
 impl Attribute {
@@ -266,7 +266,7 @@ pub fn is_scoped(&self) -> bool {
 
 impl MetaItem {
     pub fn name(&self) -> Name {
-        name_from_path(&self.name)
+        name_from_path(&self.ident)
     }
 
     pub fn value_str(&self) -> Option<Symbol> {
@@ -315,7 +315,7 @@ impl Attribute {
     pub fn meta(&self) -> Option<MetaItem> {
         let mut tokens = self.tokens.trees().peekable();
         Some(MetaItem {
-            name: self.path.clone(),
+            ident: self.path.clone(),
             node: if let Some(node) = MetaItemKind::from_tokens(&mut tokens) {
                 if tokens.peek().is_some() {
                     return None;
@@ -361,7 +361,7 @@ pub fn parse_list<'a, T, F>(&self, sess: &'a ParseSess, mut f: F) -> PResult<'a,
 
     pub fn parse_meta<'a>(&self, sess: &'a ParseSess) -> PResult<'a, MetaItem> {
         Ok(MetaItem {
-            name: self.path.clone(),
+            ident: self.path.clone(),
             node: self.parse(sess, |parser| parser.parse_meta_item_kind())?,
             span: self.span,
         })
@@ -399,41 +399,19 @@ pub fn mk_name_value_item_str(ident: Ident, value: Spanned<Symbol>) -> MetaItem
 }
 
 pub fn mk_name_value_item(span: Span, ident: Ident, value: ast::Lit) -> MetaItem {
-    MetaItem { ident, span, node: MetaItemKind::NameValue(value) }
+    MetaItem { ident: ast::Path::from_ident(ident), span, node: MetaItemKind::NameValue(value) }
 }
 
 pub fn mk_list_item(span: Span, ident: Ident, items: Vec<NestedMetaItem>) -> MetaItem {
-    MetaItem { ident, span, node: MetaItemKind::List(items) }
+    MetaItem { ident: ast::Path::from_ident(ident), span, node: MetaItemKind::List(items) }
 }
 
 pub fn mk_word_item(ident: Ident) -> MetaItem {
-    MetaItem { ident, span: ident.span, node: MetaItemKind::Word }
+    MetaItem { ident: ast::Path::from_ident(ident), span: ident.span, node: MetaItemKind::Word }
 }
 
-pub fn mk_word_item(name: Name) -> MetaItem {
-    mk_spanned_word_item(DUMMY_SP, name)
-}
-
-macro_rules! mk_spanned_meta_item {
-    ($sp:ident, $name:ident, $node:expr) => {
-        MetaItem {
-            span: $sp,
-            name: ast::Path::from_ident($sp, ast::Ident::with_empty_ctxt($name)),
-            node: $node,
-        }
-    }
-}
-
-pub fn mk_spanned_name_value_item(sp: Span, name: Name, value: ast::Lit) -> MetaItem {
-    mk_spanned_meta_item!(sp, name, MetaItemKind::NameValue(value))
-}
-
-pub fn mk_spanned_list_item(sp: Span, name: Name, items: Vec<NestedMetaItem>) -> MetaItem {
-    mk_spanned_meta_item!(sp, name, MetaItemKind::List(items))
-}
-
-pub fn mk_spanned_word_item(sp: Span, name: Name) -> MetaItem {
-    mk_spanned_meta_item!(sp, name, MetaItemKind::Word)
+pub fn mk_nested_word_item(ident: Ident) -> NestedMetaItem {
+    respan(ident.span, NestedMetaItemKind::MetaItem(mk_word_item(ident)))
 }
 
 pub fn mk_attr_id() -> AttrId {
@@ -457,7 +435,7 @@ pub fn mk_spanned_attr_inner(sp: Span, id: AttrId, item: MetaItem) -> Attribute
     Attribute {
         id,
         style: ast::AttrStyle::Inner,
-        path: item.name,
+        path: item.ident,
         tokens: item.node.tokens(item.span),
         is_sugared_doc: false,
         span: sp,
@@ -475,7 +453,7 @@ pub fn mk_spanned_attr_outer(sp: Span, id: AttrId, item: MetaItem) -> Attribute
     Attribute {
         id,
         style: ast::AttrStyle::Outer,
-        path: item.name,
+        path: item.ident,
         tokens: item.node.tokens(item.span),
         is_sugared_doc: false,
         span: sp,
@@ -1082,7 +1060,7 @@ pub fn find_repr_attrs(diagnostic: &Handler, attr: &Attribute) -> Vec<ReprAttr>
                     }
                 } else {
                     if let Some(meta_item) = item.meta_item() {
-                        if meta_item.ident.name == "align" {
+                        if meta_item.name() == "align" {
                             if let MetaItemKind::NameValue(ref value) = meta_item.node {
                                 recognised = true;
                                 let mut err = struct_span_err!(diagnostic, item.span, E0693,
@@ -1165,14 +1143,17 @@ fn tokens(&self) -> TokenStream {
         let mut idents = vec![];
         let mut last_pos = BytePos(0 as u32);
         // FIXME: Share code with `parse_path`.
-        for (i, segment) in self.name.segments.iter().enumerate() {
+        for (i, segment) in self.ident.segments.iter().enumerate() {
             let is_first = i == 0;
             if !is_first {
-                let mod_sep_span = Span::new(last_pos, segment.span.lo(), segment.span.ctxt());
+                let mod_sep_span = Span::new(last_pos,
+                                             segment.ident.span.lo(),
+                                             segment.ident.span.ctxt());
                 idents.push(TokenTree::Token(mod_sep_span, Token::ModSep).into());
             }
-            idents.push(TokenTree::Token(segment.span, Token::Ident(segment.identifier)).into());
-            last_pos = segment.span.hi();
+            idents.push(TokenTree::Token(segment.ident.span,
+                                         Token::from_ast_ident(segment.ident)).into());
+            last_pos = segment.ident.span.hi();
         }
         idents.push(self.node.tokens(self.span));
         TokenStream::concat(idents)
@@ -1181,14 +1162,14 @@ fn tokens(&self) -> TokenStream {
     fn from_tokens<I>(tokens: &mut iter::Peekable<I>) -> Option<MetaItem>
         where I: Iterator<Item = TokenTree>,
     {
-        let name = match tokens.next() {
-            Some(TokenTree::Token(span, Token::Ident(ident))) => {
+        let ident = match tokens.next() {
+            Some(TokenTree::Token(span, Token::Ident(ident, _))) => {
                 if let Some(TokenTree::Token(_, Token::ModSep)) = tokens.peek() {
                     tokens.next();
                     let mut segments = vec![];
                     loop {
-                        if let Some(TokenTree::Token(span, Token::Ident(ident))) = tokens.next() {
-                            segments.push(ast::PathSegment::from_ident(ident, span));
+                        if let Some(TokenTree::Token(_, Token::Ident(ident, _))) = tokens.next() {
+                            segments.push(ast::PathSegment::from_ident(ident));
                         } else {
                             return None;
                         }
@@ -1200,12 +1181,12 @@ fn from_tokens<I>(tokens: &mut iter::Peekable<I>) -> Option<MetaItem>
                     }
                     ast::Path { span, segments }
                 } else {
-                    ast::Path::from_ident(span, ident)
+                    ast::Path::from_ident(ident)
                 }
             }
             Some(TokenTree::Token(_, Token::Interpolated(ref nt))) => match nt.0 {
-                token::Nonterminal::NtIdent(ident) => {
-                    ast::Path::from_ident(ident.span, ident.node)
+                token::Nonterminal::NtIdent(ident, _) => {
+                    ast::Path::from_ident(ident)
                 }
                 token::Nonterminal::NtMeta(ref meta) => return Some(meta.clone()),
                 token::Nonterminal::NtPath(ref path) => path.clone(),
@@ -1217,11 +1198,11 @@ fn from_tokens<I>(tokens: &mut iter::Peekable<I>) -> Option<MetaItem>
         let node = MetaItemKind::from_tokens(tokens)?;
         let hi = match node {
             MetaItemKind::NameValue(ref lit) => lit.span.hi(),
-            MetaItemKind::List(..) => list_closing_paren_pos.unwrap_or(name.span.hi()),
-            _ => name.span.hi(),
+            MetaItemKind::List(..) => list_closing_paren_pos.unwrap_or(ident.span.hi()),
+            _ => ident.span.hi(),
         };
-        let span = name.span.with_hi(hi);
-        Some(MetaItem { name, node, span })
+        let span = ident.span.with_hi(hi);
+        Some(MetaItem { ident, node, span })
     }
 }
 
index 41cd9c595d2c82c9ac8b732ca891e7277064a6ad..584b9455a93ada1e39174e6ed92c7ae2ab2eaf50 100644 (file)
@@ -810,7 +810,7 @@ fn expand_derive_invoc(&mut self,
                 invoc.expansion_data.mark.set_expn_info(expn_info);
                 let span = span.with_ctxt(self.cx.backtrace());
                 let dummy = ast::MetaItem { // FIXME(jseyfried) avoid this
-                    name: Path::from_ident(DUMMY_SP, keywords::Invalid.ident()),
+                    ident: Path::from_ident(keywords::Invalid.ident()),
                     span: DUMMY_SP,
                     node: ast::MetaItemKind::Word,
                 };
index 4405c1a2658502c3d63ed371161be11ef4b291ed..18bf54451239a93ebb0e220f8a7d8a2a2c09b926 100644 (file)
@@ -462,7 +462,7 @@ pub fn walk_feature_fields<F>(&self, mut f: F)
     (active, extern_prelude, "1.27.0", Some(44660), Some(Edition::Edition2018)),
     
     // Scoped attributes
-    (active, tool_attributes, "1.25.0", Some(44690)),
+    (active, tool_attributes, "1.25.0", Some(44690), None),
 );
 
 declare_features! (
@@ -1175,12 +1175,28 @@ fn check_attribute(&self, attr: &ast::Attribute, is_macro: bool) {
             // before the plugin attributes are registered
             // so we skip this then
             if !is_macro {
-                gate_feature!(self, custom_attribute, attr.span,
-                              &format!("The attribute `{}` is currently \
-                                        unknown to the compiler and \
-                                        may have meaning \
-                                        added to it in the future",
-                                       attr.path));
+                if attr.is_scoped() {
+                    gate_feature!(self, tool_attributes, attr.span,
+                                  &format!("scoped attribute `{}` is experimental", attr.path));
+                    if attr::is_known_tool(attr) {
+                        attr::mark_used(attr);
+                    } else {
+                        span_err!(
+                            self.parse_sess.span_diagnostic,
+                            attr.span,
+                            E0694,
+                            "an unknown tool name found in scoped attribute: `{}`.",
+                            attr.path
+                        );
+                    }
+                } else {
+                    gate_feature!(self, custom_attribute, attr.span,
+                                  &format!("the attribute `{}` is currently \
+                                            unknown to the compiler and \
+                                            may have meaning \
+                                            added to it in the future",
+                                           attr.path));
+                }
             }
         }
     }
@@ -1846,7 +1862,7 @@ fn feature_removed(span_handler: &Handler, span: Span, reason: Option<&str>) {
                 for mi in list {
 
                     let name = if let Some(word) = mi.word() {
-                        word.ident.name
+                        word.name()
                     } else {
                         span_err!(span_handler, mi.span, E0556,
                                   "malformed feature, expected just one word");
index 0671f29648f918c8db4df47c71a15cd96325ab54..cceed589212561c06d0482a79b7f011222956156 100644 (file)
@@ -149,7 +149,7 @@ pub fn parse_path_and_tokens(&mut self) -> PResult<'a, (ast::Path, TokenStream)>
         };
         Ok(if let Some(meta) = meta {
             self.bump();
-            (meta.name, meta.node.tokens(meta.span))
+            (meta.ident, meta.node.tokens(meta.span))
         } else {
             (self.parse_path(PathStyle::Mod)?, self.parse_tokens())
         })
@@ -225,10 +225,10 @@ pub fn parse_meta_item(&mut self) -> PResult<'a, ast::MetaItem> {
         }
 
         let lo = self.span;
-        let name = self.parse_path(PathStyle::Mod)?;
+        let ident = self.parse_path(PathStyle::Mod)?;
         let node = self.parse_meta_item_kind()?;
         let span = lo.to(self.prev_span);
-        Ok(ast::MetaItem { name, node, span })
+        Ok(ast::MetaItem { ident, node, span })
     }
 
     pub fn parse_meta_item_kind(&mut self) -> PResult<'a, ast::MetaItemKind> {
index d8fd387049588f81a00c0ff7477deb02e2f38c4f..0e3bced3222f6d489c27cf7f0b4c9b787f242e7c 100644 (file)
@@ -1955,17 +1955,17 @@ pub fn parse_path_common(&mut self, style: PathStyle, enable_warning: bool)
     /// Like `parse_path`, but also supports parsing `Word` meta items into paths for back-compat.
     /// This is used when parsing derive macro paths in `#[derive]` attributes.
     pub fn parse_path_allowing_meta(&mut self, style: PathStyle) -> PResult<'a, ast::Path> {
-        let meta_name = match self.token {
+        let meta_ident = match self.token {
             token::Interpolated(ref nt) => match nt.0 {
                 token::NtMeta(ref meta) => match meta.node {
-                    ast::MetaItemKind::Word => Some(meta.name.clone()),
+                    ast::MetaItemKind::Word => Some(meta.ident.clone()),
                     _ => None,
                 },
                 _ => None,
             },
             _ => None,
         };
-        if let Some(path) = meta_name {
+        if let Some(path) = meta_ident {
             self.bump();
             return Ok(path);
         }
index 96f7caf165c9f2d8ca24efcd38612fd646c159ff..f78e3f3084bdb387d56b86cc7fa08c9afaec864b 100644 (file)
@@ -719,12 +719,12 @@ fn print_attribute_path(&mut self, path: &ast::Path) -> io::Result<()> {
             if i > 0 {
                 self.writer().word("::")?
             }
-            if segment.identifier.name != keywords::CrateRoot.name() &&
-               segment.identifier.name != keywords::DollarCrate.name()
+            if segment.ident.name != keywords::CrateRoot.name() &&
+               segment.ident.name != keywords::DollarCrate.name()
             {
-                self.writer().word(&segment.identifier.name.as_str())?;
-            } else if segment.identifier.name == keywords::DollarCrate.name() {
-                self.print_dollar_crate(segment.identifier.ctxt)?;
+                self.writer().word(&segment.ident.name.as_str())?;
+            } else if segment.ident.name == keywords::DollarCrate.name() {
+                self.print_dollar_crate(segment.ident.span.ctxt())?;
             }
         }
         Ok(())
@@ -773,15 +773,15 @@ fn print_meta_list_item(&mut self, item: &ast::NestedMetaItem) -> io::Result<()>
     fn print_meta_item(&mut self, item: &ast::MetaItem) -> io::Result<()> {
         self.ibox(INDENT_UNIT)?;
         match item.node {
-            ast::MetaItemKind::Word => self.print_attribute_path(&item.name)?,
+            ast::MetaItemKind::Word => self.print_attribute_path(&item.ident)?,
             ast::MetaItemKind::NameValue(ref value) => {
-                self.print_attribute_path(&item.name)?;
+                self.print_attribute_path(&item.ident)?;
                 self.writer().space()?;
                 self.word_space("=")?;
                 self.print_literal(value)?;
             }
             ast::MetaItemKind::List(ref items) => {
-                self.print_attribute_path(&item.name)?;
+                self.print_attribute_path(&item.ident)?;
                 self.popen()?;
                 self.commasep(Consistent,
                               &items[..],
index 0cb897917b44526d5175a403ef925c99f0aa3c2e..c2192a21d90501026685cdeadd82c30dff2e3086 100644 (file)
@@ -10,7 +10,7 @@
 
 #![feature(tool_attributes)]
 
-#![foo::bar] //~ ERROR An unknown tool name found in scoped attributes: `foo::bar`. [E0693]
+#![foo::bar] //~ ERROR an unknown tool name found in scoped attribute: `foo::bar`. [E0694]
 
-#[foo::bar] //~ ERROR An unknown tool name found in scoped attributes: `foo::bar`. [E0693]
+#[foo::bar] //~ ERROR an unknown tool name found in scoped attribute: `foo::bar`. [E0694]
 fn main() {}
index fbc46219461957a0e54759e9f7189660e727dd2d..ba38c297a1127924e9d5cd62778ca254f8baeba8 100644 (file)
@@ -14,5 +14,5 @@
 
 #[foo::bar]
 //~^ ERROR scoped attribute `foo::bar` is experimental (see issue #44690) [E0658]
-//~^^ ERROR An unknown tool name found in scoped attributes: `foo::bar`. [E0693]
+//~^^ ERROR an unknown tool name found in scoped attribute: `foo::bar`. [E0694]
 fn main() {}
index 13307bd713309169336a3a553bacc53cec8289a7..da89c4a5ef692634badba632f031afb2c0009dcb 100644 (file)
@@ -1,10 +1,11 @@
 error[E0658]: scoped attribute `rustfmt::skip` is experimental (see issue #44690)
   --> $DIR/feature-gate-tool_attributes.rs:12:5
    |
-12 |     #[rustfmt::skip] //~ ERROR scoped attribute `rustfmt::skip` is experimental
+LL |     #[rustfmt::skip] //~ ERROR scoped attribute `rustfmt::skip` is experimental
    |     ^^^^^^^^^^^^^^^^
    |
    = help: add #![feature(tool_attributes)] to the crate attributes to enable
 
 error: aborting due to previous error
 
+For more information about this error, try `rustc --explain E0658`.