diff --git a/src/librustc_trans/symbol_cache.rs b/src/librustc_trans/symbol_cache.rs index a838c3a2c4c..ddc1ef537a5 100644 --- a/src/librustc_trans/symbol_cache.rs +++ b/src/librustc_trans/symbol_cache.rs @@ -8,9 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std::cell::RefCell; -use std::rc::Rc; use rustc::ty::TyCtxt; +use std::cell::RefCell; +use syntax_pos::symbol::{InternedString, Symbol}; use trans_item::TransItem; use util::nodemap::FxHashMap; @@ -22,7 +22,7 @@ use util::nodemap::FxHashMap; pub struct SymbolCache<'a, 'tcx: 'a> { tcx: TyCtxt<'a, 'tcx, 'tcx>, - index: RefCell, Rc>>, + index: RefCell, Symbol>>, } impl<'a, 'tcx> SymbolCache<'a, 'tcx> { @@ -33,10 +33,10 @@ impl<'a, 'tcx> SymbolCache<'a, 'tcx> { } } - pub fn get(&self, trans_item: TransItem<'tcx>) -> Rc { + pub fn get(&self, trans_item: TransItem<'tcx>) -> InternedString { let mut index = self.index.borrow_mut(); index.entry(trans_item) - .or_insert_with(|| Rc::new(trans_item.compute_symbol_name(self.tcx))) - .clone() + .or_insert_with(|| Symbol::intern(&trans_item.compute_symbol_name(self.tcx))) + .as_str() } }