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) { fn resolve_place_op(&self, op: PlaceOp, is_mut: bool) -> (Option<DefId>, ast::Ident) {
let (tr, name) = match (op, is_mut) { let (tr, name) = match (op, is_mut) {
(PlaceOp::Deref, false) => (PlaceOp::Deref, false) => (self.tcx.lang_items().deref_trait(), sym::deref),
(self.tcx.lang_items().deref_trait(), "deref"), (PlaceOp::Deref, true) => (self.tcx.lang_items().deref_mut_trait(), sym::deref_mut),
(PlaceOp::Deref, true) => (PlaceOp::Index, false) => (self.tcx.lang_items().index_trait(), sym::index),
(self.tcx.lang_items().deref_mut_trait(), "deref_mut"), (PlaceOp::Index, true) => (self.tcx.lang_items().index_mut_trait(), sym::index_mut),
(PlaceOp::Index, false) =>
(self.tcx.lang_items().index_trait(), "index"),
(PlaceOp::Index, true) =>
(self.tcx.lang_items().index_mut_trait(), "index_mut"),
}; };
(tr, ast::Ident::from_str(name)) (tr, ast::Ident::with_empty_ctxt(name))
} }
fn try_overloaded_place_op(&self, fn try_overloaded_place_op(&self,

View File

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