Skip to content

Commit 6c0ff3d

Browse files
committed
Avoid interning in resolve_place_op.
This function is hot for `keccak`.
1 parent 37c45ec commit 6c0ff3d

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
@@ -2697,16 +2697,12 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
26972697

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

27122708
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,
@@ -291,6 +293,8 @@ symbols! {
291293
impl_header_lifetime_elision,
292294
impl_trait_in_bindings,
293295
import_shadowing,
296+
index,
297+
index_mut,
294298
in_band_lifetimes,
295299
include,
296300
inclusive_range_syntax,

0 commit comments

Comments
 (0)