about summary refs log tree commit diff
path: root/src/libsyntax/diagnostics
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2016-11-21 08:08:47 -0600
committerGitHub <noreply@github.com>2016-11-21 08:08:47 -0600
commitebec55406ba94faf8b2cd23b27a8f74df97d1ca4 (patch)
tree446c06caed20d58ba039ba0e7739a89a136e74aa /src/libsyntax/diagnostics
parent59b87b3975c97820b32ba6ebee8eac2a13ab883b (diff)
parenta8e86f0f816c9666915c73e80969dbf85a5afd56 (diff)
downloadrust-ebec55406ba94faf8b2cd23b27a8f74df97d1ca4.tar.gz
rust-ebec55406ba94faf8b2cd23b27a8f74df97d1ca4.zip
Auto merge of #37824 - jseyfried:symbols, r=eddyb
Clean up `ast::Attribute`, `ast::CrateConfig`, and string interning

This PR
 - removes `ast::Attribute_` (changing `Attribute` from `Spanned<Attribute_>` to a struct),
 - moves a `MetaItem`'s name from the `MetaItemKind` variants to a field of `MetaItem`,
 - avoids needlessly wrapping `ast::MetaItem` with `P`,
 - moves string interning into `syntax::symbol` (`ast::Name` is a reexport of `symbol::Symbol` for now),
 - replaces `InternedString` with `Symbol` in the AST, HIR, and various other places, and
 - refactors `ast::CrateConfig` from a `Vec` to a `HashSet`.

r? @eddyb
Diffstat (limited to 'src/libsyntax/diagnostics')
-rw-r--r--src/libsyntax/diagnostics/plugin.rs9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/libsyntax/diagnostics/plugin.rs b/src/libsyntax/diagnostics/plugin.rs
index 81c8e0bdb82..fe5cb87ad59 100644
--- a/src/libsyntax/diagnostics/plugin.rs
+++ b/src/libsyntax/diagnostics/plugin.rs
@@ -19,6 +19,7 @@ use ext::base::{ExtCtxt, MacEager, MacResult};
 use ext::build::AstBuilder;
 use parse::token;
 use ptr::P;
+use symbol::Symbol;
 use tokenstream::{TokenTree};
 use util::small_vector::SmallVector;
 
@@ -141,7 +142,7 @@ pub fn expand_register_diagnostic<'cx>(ecx: &'cx mut ExtCtxt,
             ));
         }
     });
-    let sym = Ident::with_empty_ctxt(token::gensym(&format!(
+    let sym = Ident::with_empty_ctxt(Symbol::gensym(&format!(
         "__register_diagnostic_{}", code
     )));
     MacEager::items(SmallVector::many(vec![
@@ -194,11 +195,11 @@ pub fn expand_build_diagnostic_array<'cx>(ecx: &'cx mut ExtCtxt,
     let (count, expr) =
         with_registered_diagnostics(|diagnostics| {
             let descriptions: Vec<P<ast::Expr>> =
-                diagnostics.iter().filter_map(|(code, info)| {
+                diagnostics.iter().filter_map(|(&code, info)| {
                     info.description.map(|description| {
                         ecx.expr_tuple(span, vec![
-                            ecx.expr_str(span, code.as_str()),
-                            ecx.expr_str(span, description.as_str())
+                            ecx.expr_str(span, code),
+                            ecx.expr_str(span, description)
                         ])
                     })
                 }).collect();