Avoid interning in `resolve_place_op`.

This function is hot for `keccak`.
This commit is contained in:
Nicholas Nethercote 2019-05-22 10:15:32 +10:00
parent 37c45ec398
commit 6c0ff3dd97
2 changed files with 9 additions and 9 deletions

View File

@ -2697,16 +2697,12 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
fn resolve_place_op(&self, op: PlaceOp, is_mut: bool) -> (Option<DefId>, ast::Ident) {
let (tr, name) = match (op, is_mut) {
(PlaceOp::Deref, false) =>
(self.tcx.lang_items().deref_trait(), "deref"),
(PlaceOp::Deref, true) =>
(self.tcx.lang_items().deref_mut_trait(), "deref_mut"),
(PlaceOp::Index, false) =>
(self.tcx.lang_items().index_trait(), "index"),
(PlaceOp::Index, true) =>
(self.tcx.lang_items().index_mut_trait(), "index_mut"),
(PlaceOp::Deref, false) => (self.tcx.lang_items().deref_trait(), sym::deref),
(PlaceOp::Deref, true) => (self.tcx.lang_items().deref_mut_trait(), sym::deref_mut),
(PlaceOp::Index, false) => (self.tcx.lang_items().index_trait(), sym::index),
(PlaceOp::Index, true) => (self.tcx.lang_items().index_mut_trait(), sym::index_mut),
};
(tr, ast::Ident::from_str(name))
(tr, ast::Ident::with_empty_ctxt(name))
}
fn try_overloaded_place_op(&self,

View File

@ -204,6 +204,8 @@ symbols! {
default_type_params,
deny,
deprecated,
deref,
deref_mut,
derive,
doc,
doc_alias,
@ -291,6 +293,8 @@ symbols! {
impl_header_lifetime_elision,
impl_trait_in_bindings,
import_shadowing,
index,
index_mut,
in_band_lifetimes,
include,
inclusive_range_syntax,