1
Fork 0

Avoid unnecessary interning in Ident::from_str() calls.

A lot of these static symbols are pre-interned.
This commit is contained in:
Nicholas Nethercote 2019-05-17 18:37:53 +10:00
parent be3724fb7c
commit 86cc326d06
13 changed files with 45 additions and 36 deletions

View file

@ -77,9 +77,11 @@ pub fn maybe_inject_crates_ref(
None
};
krate.module.items.insert(0, P(ast::Item {
attrs: vec![attr::mk_attr_outer(DUMMY_SP,
attr::mk_attr_id(),
attr::mk_word_item(ast::Ident::from_str("macro_use")))],
attrs: vec![attr::mk_attr_outer(
DUMMY_SP,
attr::mk_attr_id(),
attr::mk_word_item(ast::Ident::with_empty_ctxt(sym::macro_use))
)],
vis: dummy_spanned(ast::VisibilityKind::Inherited),
node: ast::ItemKind::ExternCrate(alt_std_name.or(orig_name)),
ident: ast::Ident::with_empty_ctxt(rename),