@@ -137,7 +137,7 @@ fn get_symbol_hash<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
137
137
// values for generic type parameters,
138
138
// if any.
139
139
substs : Option < & ' tcx Substs < ' tcx > > )
140
- -> String {
140
+ -> u64 {
141
141
debug ! ( "get_symbol_hash(def_id={:?}, parameters={:?})" , def_id, substs) ;
142
142
143
143
let mut hasher = ty:: util:: TypeIdHasher :: < u64 > :: new ( tcx) ;
@@ -172,7 +172,7 @@ fn get_symbol_hash<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
172
172
} ) ;
173
173
174
174
// 64 bits should be enough to avoid collisions.
175
- format ! ( "h{:016x}" , hasher. finish( ) )
175
+ hasher. finish ( )
176
176
}
177
177
178
178
fn def_symbol_name < ' a , ' tcx > ( tcx : TyCtxt < ' a , ' tcx , ' tcx > , def_id : DefId )
@@ -280,7 +280,7 @@ fn compute_symbol_name<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, instance: Instance
280
280
281
281
let hash = get_symbol_hash ( tcx, Some ( def_id) , instance_ty, Some ( substs) ) ;
282
282
283
- SymbolPathBuffer :: from_interned ( tcx. def_symbol_name ( def_id) ) . finish ( & hash)
283
+ SymbolPathBuffer :: from_interned ( tcx. def_symbol_name ( def_id) ) . finish ( hash)
284
284
}
285
285
286
286
// Follow C++ namespace-mangling style, see
@@ -324,10 +324,9 @@ impl SymbolPathBuffer {
324
324
ty:: SymbolName { name : Symbol :: intern ( & self . result ) . as_str ( ) }
325
325
}
326
326
327
- fn finish ( mut self , hash : & str ) -> String {
328
- // end name-sequence
329
- self . push ( hash) ;
330
- self . result . push ( 'E' ) ;
327
+ fn finish ( mut self , hash : u64 ) -> String {
328
+ // E = end name-sequence
329
+ let _ = write ! ( self . result, "17h{:016x}E" , hash) ;
331
330
self . result
332
331
}
333
332
}
@@ -356,7 +355,7 @@ pub fn exported_name_from_type_and_prefix<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
356
355
let hash = get_symbol_hash ( tcx, None , t, None ) ;
357
356
let mut buffer = SymbolPathBuffer :: new ( ) ;
358
357
buffer. push ( prefix) ;
359
- buffer. finish ( & hash)
358
+ buffer. finish ( hash)
360
359
}
361
360
362
361
// Name sanitation. LLVM will happily accept identifiers with weird names, but
0 commit comments