88// option. This file may not be copied, modified, or distributed
99// except according to those terms.
1010
11- use std:: cell:: RefCell ;
12- use std:: rc:: Rc ;
1311use rustc:: ty:: TyCtxt ;
12+ use std:: cell:: RefCell ;
13+ use syntax_pos:: symbol:: { InternedString , Symbol } ;
1414use trans_item:: TransItem ;
1515use util:: nodemap:: FxHashMap ;
1616
@@ -22,7 +22,7 @@ use util::nodemap::FxHashMap;
2222
2323pub struct SymbolCache < ' a , ' tcx : ' a > {
2424 tcx : TyCtxt < ' a , ' tcx , ' tcx > ,
25- index : RefCell < FxHashMap < TransItem < ' tcx > , Rc < String > > > ,
25+ index : RefCell < FxHashMap < TransItem < ' tcx > , Symbol > > ,
2626}
2727
2828impl < ' a , ' tcx > SymbolCache < ' a , ' tcx > {
@@ -33,10 +33,10 @@ impl<'a, 'tcx> SymbolCache<'a, 'tcx> {
3333 }
3434 }
3535
36- pub fn get ( & self , trans_item : TransItem < ' tcx > ) -> Rc < String > {
36+ pub fn get ( & self , trans_item : TransItem < ' tcx > ) -> InternedString {
3737 let mut index = self . index . borrow_mut ( ) ;
3838 index. entry ( trans_item)
39- . or_insert_with ( || Rc :: new ( trans_item. compute_symbol_name ( self . tcx ) ) )
40- . clone ( )
39+ . or_insert_with ( || Symbol :: intern ( & trans_item. compute_symbol_name ( self . tcx ) ) )
40+ . as_str ( )
4141 }
4242}
0 commit comments