8
8
// option. This file may not be copied, modified, or distributed
9
9
// except according to those terms.
10
10
11
- use std:: cell:: RefCell ;
12
- use std:: rc:: Rc ;
13
11
use rustc:: ty:: TyCtxt ;
12
+ use std:: cell:: RefCell ;
13
+ use syntax_pos:: symbol:: { InternedString , Symbol } ;
14
14
use trans_item:: TransItem ;
15
15
use util:: nodemap:: FxHashMap ;
16
16
@@ -22,7 +22,7 @@ use util::nodemap::FxHashMap;
22
22
23
23
pub struct SymbolCache < ' a , ' tcx : ' a > {
24
24
tcx : TyCtxt < ' a , ' tcx , ' tcx > ,
25
- index : RefCell < FxHashMap < TransItem < ' tcx > , Rc < String > > > ,
25
+ index : RefCell < FxHashMap < TransItem < ' tcx > , Symbol > > ,
26
26
}
27
27
28
28
impl < ' a , ' tcx > SymbolCache < ' a , ' tcx > {
@@ -33,10 +33,10 @@ impl<'a, 'tcx> SymbolCache<'a, 'tcx> {
33
33
}
34
34
}
35
35
36
- pub fn get ( & self , trans_item : TransItem < ' tcx > ) -> Rc < String > {
36
+ pub fn get ( & self , trans_item : TransItem < ' tcx > ) -> InternedString {
37
37
let mut index = self . index . borrow_mut ( ) ;
38
38
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 ( )
41
41
}
42
42
}
0 commit comments