about summary refs log tree commit diff
path: root/src/libsyntax/attr
diff options
context:
space:
mode:
authorNicholas Nethercote <nnethercote@mozilla.com>2019-05-17 18:37:53 +1000
committerNicholas Nethercote <nnethercote@mozilla.com>2019-05-17 20:10:50 +1000
commit86cc326d0665997669ca6069c5bb2619e1955f6c (patch)
treecf0e1d660fe5c44ab4f65783479d40146e4bf56f /src/libsyntax/attr
parentbe3724fb7cd416ad3d7016fd3917f0f6a68714c8 (diff)
downloadrust-86cc326d0665997669ca6069c5bb2619e1955f6c.tar.gz
rust-86cc326d0665997669ca6069c5bb2619e1955f6c.zip
Avoid unnecessary interning in `Ident::from_str()` calls.
A lot of these static symbols are pre-interned.
Diffstat (limited to 'src/libsyntax/attr')
-rw-r--r--src/libsyntax/attr/mod.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/libsyntax/attr/mod.rs b/src/libsyntax/attr/mod.rs
index d94a3165b0f..592b40df176 100644
--- a/src/libsyntax/attr/mod.rs
+++ b/src/libsyntax/attr/mod.rs
@@ -22,7 +22,7 @@ use crate::parse::parser::Parser;
 use crate::parse::{self, ParseSess, PResult};
 use crate::parse::token::{self, Token};
 use crate::ptr::P;
-use crate::symbol::{keywords, Symbol};
+use crate::symbol::{keywords, Symbol, sym};
 use crate::ThinVec;
 use crate::tokenstream::{TokenStream, TokenTree, DelimSpan};
 use crate::GLOBALS;
@@ -323,7 +323,7 @@ impl Attribute {
         if self.is_sugared_doc {
             let comment = self.value_str().unwrap();
             let meta = mk_name_value_item_str(
-                Ident::from_str("doc"),
+                Ident::with_empty_ctxt(sym::doc),
                 dummy_spanned(Symbol::intern(&strip_doc_comment_decoration(&comment.as_str()))));
             let mut attr = if self.style == ast::AttrStyle::Outer {
                 mk_attr_outer(self.span, self.id, meta)
@@ -414,7 +414,7 @@ pub fn mk_sugared_doc_attr(id: AttrId, text: Symbol, span: Span) -> Attribute {
     Attribute {
         id,
         style,
-        path: Path::from_ident(Ident::from_str("doc").with_span_pos(span)),
+        path: Path::from_ident(Ident::with_empty_ctxt(sym::doc).with_span_pos(span)),
         tokens: MetaItemKind::NameValue(lit).tokens(span),
         is_sugared_doc: true,
         span,