about summary refs log tree commit diff
path: root/src/libsyntax_ext/deriving/clone.rs
diff options
context:
space:
mode:
authorNicholas Nethercote <nnethercote@mozilla.com>2019-05-22 14:41:15 +1000
committerNicholas Nethercote <nnethercote@mozilla.com>2019-05-27 13:58:38 +1000
commit58c68d00fd1702b74e67dcb6f6f54483c066ef31 (patch)
tree7f5f87e82208384ba738310d095861cc3d108c59 /src/libsyntax_ext/deriving/clone.rs
parent26451ef7b5e00887dc8f27717ff34262df23d655 (diff)
downloadrust-58c68d00fd1702b74e67dcb6f6f54483c066ef31.tar.gz
rust-58c68d00fd1702b74e67dcb6f6f54483c066ef31.zip
Pass symbols to `ExtCtxt::std_path` instead of strings.
Because this function is hot.

Also remove the dead `ty_option` function.
Diffstat (limited to 'src/libsyntax_ext/deriving/clone.rs')
-rw-r--r--src/libsyntax_ext/deriving/clone.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/libsyntax_ext/deriving/clone.rs b/src/libsyntax_ext/deriving/clone.rs
index 417dd2525d6..b3b6328e2ca 100644
--- a/src/libsyntax_ext/deriving/clone.rs
+++ b/src/libsyntax_ext/deriving/clone.rs
@@ -7,7 +7,7 @@ use syntax::attr;
 use syntax::ext::base::{Annotatable, ExtCtxt};
 use syntax::ext::build::AstBuilder;
 use syntax::ptr::P;
-use syntax::symbol::{kw, sym};
+use syntax::symbol::{kw, sym, Symbol};
 use syntax_pos::Span;
 
 pub fn expand_deriving_clone(cx: &mut ExtCtxt<'_>,
@@ -115,7 +115,7 @@ fn cs_clone_shallow(name: &str,
         // set the expn ID so we can use the unstable struct.
         let span = span.with_ctxt(cx.backtrace());
         let assert_path = cx.path_all(span, true,
-                                        cx.std_path(&["clone", helper_name]),
+                                        cx.std_path(&[sym::clone, Symbol::intern(helper_name)]),
                                         vec![GenericArg::Type(ty)], vec![]);
         stmts.push(cx.stmt_let_type_only(span, cx.ty_path(assert_path)));
     }
@@ -157,7 +157,7 @@ fn cs_clone(name: &str,
             -> P<Expr> {
     let ctor_path;
     let all_fields;
-    let fn_path = cx.std_path(&["clone", "Clone", "clone"]);
+    let fn_path = cx.std_path(&[sym::clone, sym::Clone, sym::clone]);
     let subcall = |cx: &mut ExtCtxt<'_>, field: &FieldInfo<'_>| {
         let args = vec![cx.expr_addr_of(field.span, field.self_.clone())];
         cx.expr_call_global(field.span, fn_path.clone(), args)