@@ -137,7 +137,7 @@ fn get_symbol_hash<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
137137 // values for generic type parameters,
138138 // if any.
139139 substs : Option < & ' tcx Substs < ' tcx > > )
140- -> String {
140+ -> u64 {
141141 debug ! ( "get_symbol_hash(def_id={:?}, parameters={:?})" , def_id, substs) ;
142142
143143 let mut hasher = ty:: util:: TypeIdHasher :: < u64 > :: new ( tcx) ;
@@ -172,7 +172,7 @@ fn get_symbol_hash<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
172172 } ) ;
173173
174174 // 64 bits should be enough to avoid collisions.
175- format ! ( "h{:016x}" , hasher. finish( ) )
175+ hasher. finish ( )
176176}
177177
178178fn 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
280280
281281 let hash = get_symbol_hash ( tcx, Some ( def_id) , instance_ty, Some ( substs) ) ;
282282
283- SymbolPathBuffer :: from_interned ( tcx. def_symbol_name ( def_id) ) . finish ( & hash)
283+ SymbolPathBuffer :: from_interned ( tcx. def_symbol_name ( def_id) ) . finish ( hash)
284284}
285285
286286// Follow C++ namespace-mangling style, see
@@ -324,10 +324,9 @@ impl SymbolPathBuffer {
324324 ty:: SymbolName { name : Symbol :: intern ( & self . result ) . as_str ( ) }
325325 }
326326
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) ;
331330 self . result
332331 }
333332}
@@ -356,7 +355,7 @@ pub fn exported_name_from_type_and_prefix<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
356355 let hash = get_symbol_hash ( tcx, None , t, None ) ;
357356 let mut buffer = SymbolPathBuffer :: new ( ) ;
358357 buffer. push ( prefix) ;
359- buffer. finish ( & hash)
358+ buffer. finish ( hash)
360359}
361360
362361// Name sanitation. LLVM will happily accept identifiers with weird names, but
0 commit comments