Skip to content

Commit 29822a4

Browse files
committed
Avoid interning in resolve_place_op.
This function is hot for `keccak`.
1 parent 1cc822c commit 29822a4

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

src/librustc_typeck/check/mod.rs

+5-9
Original file line numberDiff line numberDiff line change
@@ -2698,16 +2698,12 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
26982698

26992699
fn resolve_place_op(&self, op: PlaceOp, is_mut: bool) -> (Option<DefId>, ast::Ident) {
27002700
let (tr, name) = match (op, is_mut) {
2701-
(PlaceOp::Deref, false) =>
2702-
(self.tcx.lang_items().deref_trait(), "deref"),
2703-
(PlaceOp::Deref, true) =>
2704-
(self.tcx.lang_items().deref_mut_trait(), "deref_mut"),
2705-
(PlaceOp::Index, false) =>
2706-
(self.tcx.lang_items().index_trait(), "index"),
2707-
(PlaceOp::Index, true) =>
2708-
(self.tcx.lang_items().index_mut_trait(), "index_mut"),
2701+
(PlaceOp::Deref, false) => (self.tcx.lang_items().deref_trait(), sym::deref),
2702+
(PlaceOp::Deref, true) => (self.tcx.lang_items().deref_mut_trait(), sym::deref_mut),
2703+
(PlaceOp::Index, false) => (self.tcx.lang_items().index_trait(), sym::index),
2704+
(PlaceOp::Index, true) => (self.tcx.lang_items().index_mut_trait(), sym::index_mut),
27092705
};
2710-
(tr, ast::Ident::from_str(name))
2706+
(tr, ast::Ident::with_empty_ctxt(name))
27112707
}
27122708

27132709
fn try_overloaded_place_op(&self,

src/libsyntax_pos/symbol.rs

+4
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,8 @@ symbols! {
204204
default_type_params,
205205
deny,
206206
deprecated,
207+
deref,
208+
deref_mut,
207209
derive,
208210
doc,
209211
doc_alias,
@@ -289,6 +291,8 @@ symbols! {
289291
impl_header_lifetime_elision,
290292
impl_trait_in_bindings,
291293
import_shadowing,
294+
index,
295+
index_mut,
292296
in_band_lifetimes,
293297
include,
294298
inclusive_range_syntax,

0 commit comments

Comments
 (0)