@@ -103,20 +103,20 @@ pub fn specialized_encode_alloc_id<
103103 tcx : TyCtxt < ' a , ' tcx , ' tcx > ,
104104 alloc_id : AllocId ,
105105) -> Result < ( ) , E :: Error > {
106- let alloc_type: AllocType < ' tcx > =
106+ let alloc_type: AllocKind < ' tcx > =
107107 tcx. alloc_map . lock ( ) . get ( alloc_id) . expect ( "no value for AllocId" ) ;
108108 match alloc_type {
109- AllocType :: Memory ( alloc) => {
109+ AllocKind :: Memory ( alloc) => {
110110 trace ! ( "encoding {:?} with {:#?}" , alloc_id, alloc) ;
111111 AllocDiscriminant :: Alloc . encode ( encoder) ?;
112112 alloc. encode ( encoder) ?;
113113 }
114- AllocType :: Function ( fn_instance) => {
114+ AllocKind :: Function ( fn_instance) => {
115115 trace ! ( "encoding {:?} with {:#?}" , alloc_id, fn_instance) ;
116116 AllocDiscriminant :: Fn . encode ( encoder) ?;
117117 fn_instance. encode ( encoder) ?;
118118 }
119- AllocType :: Static ( did) => {
119+ AllocKind :: Static ( did) => {
120120 // referring to statics doesn't need to know about their allocations,
121121 // just about its DefId
122122 AllocDiscriminant :: Static . encode ( encoder) ?;
@@ -291,7 +291,7 @@ impl fmt::Display for AllocId {
291291}
292292
293293#[ derive( Debug , Clone , Eq , PartialEq , Hash , RustcDecodable , RustcEncodable ) ]
294- pub enum AllocType < ' tcx > {
294+ pub enum AllocKind < ' tcx > {
295295 /// The alloc id is used as a function pointer
296296 Function ( Instance < ' tcx > ) ,
297297 /// The alloc id points to a "lazy" static variable that did not get computed (yet).
@@ -303,10 +303,10 @@ pub enum AllocType<'tcx> {
303303
304304pub struct AllocMap < ' tcx > {
305305 /// Lets you know what an AllocId refers to
306- id_to_type : FxHashMap < AllocId , AllocType < ' tcx > > ,
306+ id_to_type : FxHashMap < AllocId , AllocKind < ' tcx > > ,
307307
308308 /// Used to ensure that statics only get one associated AllocId
309- type_interner : FxHashMap < AllocType < ' tcx > , AllocId > ,
309+ type_interner : FxHashMap < AllocKind < ' tcx > , AllocId > ,
310310
311311 /// The AllocId to assign to the next requested id.
312312 /// Always incremented, never gets smaller.
@@ -339,7 +339,7 @@ impl<'tcx> AllocMap<'tcx> {
339339 next
340340 }
341341
342- fn intern ( & mut self , alloc_type : AllocType < ' tcx > ) -> AllocId {
342+ fn intern ( & mut self , alloc_type : AllocKind < ' tcx > ) -> AllocId {
343343 if let Some ( & alloc_id) = self . type_interner . get ( & alloc_type) {
344344 return alloc_id;
345345 }
@@ -356,29 +356,29 @@ impl<'tcx> AllocMap<'tcx> {
356356 /// `main as fn() == main as fn()` is false, while `let x = main as fn(); x == x` is true.
357357 pub fn create_fn_alloc ( & mut self , instance : Instance < ' tcx > ) -> AllocId {
358358 let id = self . reserve ( ) ;
359- self . id_to_type . insert ( id, AllocType :: Function ( instance) ) ;
359+ self . id_to_type . insert ( id, AllocKind :: Function ( instance) ) ;
360360 id
361361 }
362362
363363 /// Returns `None` in case the `AllocId` is dangling.
364364 /// This function exists to allow const eval to detect the difference between evaluation-
365365 /// local dangling pointers and allocations in constants/statics.
366- pub fn get ( & self , id : AllocId ) -> Option < AllocType < ' tcx > > {
366+ pub fn get ( & self , id : AllocId ) -> Option < AllocKind < ' tcx > > {
367367 self . id_to_type . get ( & id) . cloned ( )
368368 }
369369
370370 /// Panics if the `AllocId` does not refer to an `Allocation`
371371 pub fn unwrap_memory ( & self , id : AllocId ) -> & ' tcx Allocation {
372372 match self . get ( id) {
373- Some ( AllocType :: Memory ( mem) ) => mem,
373+ Some ( AllocKind :: Memory ( mem) ) => mem,
374374 _ => bug ! ( "expected allocation id {} to point to memory" , id) ,
375375 }
376376 }
377377
378378 /// Generate an `AllocId` for a static or return a cached one in case this function has been
379379 /// called on the same static before.
380380 pub fn intern_static ( & mut self , static_id : DefId ) -> AllocId {
381- self . intern ( AllocType :: Static ( static_id) )
381+ self . intern ( AllocKind :: Static ( static_id) )
382382 }
383383
384384 /// Intern the `Allocation` and return a new `AllocId`, even if there's already an identical
@@ -395,15 +395,15 @@ impl<'tcx> AllocMap<'tcx> {
395395 /// Freeze an `AllocId` created with `reserve` by pointing it at an `Allocation`. Trying to
396396 /// call this function twice, even with the same `Allocation` will ICE the compiler.
397397 pub fn set_id_memory ( & mut self , id : AllocId , mem : & ' tcx Allocation ) {
398- if let Some ( old) = self . id_to_type . insert ( id, AllocType :: Memory ( mem) ) {
398+ if let Some ( old) = self . id_to_type . insert ( id, AllocKind :: Memory ( mem) ) {
399399 bug ! ( "tried to set allocation id {}, but it was already existing as {:#?}" , id, old) ;
400400 }
401401 }
402402
403403 /// Freeze an `AllocId` created with `reserve` by pointing it at an `Allocation`. May be called
404404 /// twice for the same `(AllocId, Allocation)` pair.
405405 pub fn set_id_same_memory ( & mut self , id : AllocId , mem : & ' tcx Allocation ) {
406- self . id_to_type . insert_same ( id, AllocType :: Memory ( mem) ) ;
406+ self . id_to_type . insert_same ( id, AllocKind :: Memory ( mem) ) ;
407407 }
408408}
409409
0 commit comments