about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNiko Matsakis <niko@alum.mit.edu>2017-04-21 17:26:25 -0400
committerNiko Matsakis <niko@alum.mit.edu>2017-04-21 17:26:53 -0400
commit85527456e8375e9a2236c2cd7b3a7e043b70f75e (patch)
tree1e2581f142e525ff919254f110243c09b5fa67e2
parentf4c183b742cf08c5d06d50b4fbada3561722af81 (diff)
downloadrust-85527456e8375e9a2236c2cd7b3a7e043b70f75e.tar.gz
rust-85527456e8375e9a2236c2cd7b3a7e043b70f75e.zip
use Symbol/InternedString in the cache
-rw-r--r--src/librustc_trans/symbol_cache.rs12
1 files changed, 6 insertions, 6 deletions
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<FxHashMap<TransItem<'tcx>, Rc<String>>>,
+    index: RefCell<FxHashMap<TransItem<'tcx>, 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<String> {
+    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()
     }
 }