@@ -389,7 +389,7 @@ impl<'s> AllocDecodingSession<'s> {
389389 trace ! ( "creating fn alloc ID" ) ;
390390 let instance = ty:: Instance :: decode ( decoder) ;
391391 trace ! ( "decoded fn alloc instance: {:?}" , instance) ;
392- let alloc_id = decoder. interner ( ) . create_fn_alloc ( instance) ;
392+ let alloc_id = decoder. interner ( ) . reserve_and_set_fn_alloc ( instance) ;
393393 alloc_id
394394 }
395395 AllocDiscriminant :: VTable => {
@@ -399,15 +399,16 @@ impl<'s> AllocDecodingSession<'s> {
399399 let poly_trait_ref =
400400 <Option < ty:: PolyExistentialTraitRef < ' _ > > as Decodable < D > >:: decode ( decoder) ;
401401 trace ! ( "decoded vtable alloc instance: {ty:?}, {poly_trait_ref:?}" ) ;
402- let alloc_id = decoder. interner ( ) . create_vtable_alloc ( ty, poly_trait_ref) ;
402+ let alloc_id =
403+ decoder. interner ( ) . reserve_and_set_vtable_alloc ( ty, poly_trait_ref) ;
403404 alloc_id
404405 }
405406 AllocDiscriminant :: Static => {
406407 assert ! ( alloc_id. is_none( ) ) ;
407408 trace ! ( "creating extern static alloc ID" ) ;
408409 let did = <DefId as Decodable < D > >:: decode ( decoder) ;
409410 trace ! ( "decoded static def-ID: {:?}" , did) ;
410- let alloc_id = decoder. interner ( ) . create_static_alloc ( did) ;
411+ let alloc_id = decoder. interner ( ) . reserve_and_set_static_alloc ( did) ;
411412 alloc_id
412413 }
413414 }
@@ -544,13 +545,13 @@ impl<'tcx> TyCtxt<'tcx> {
544545
545546 /// Generates an `AllocId` for a static or return a cached one in case this function has been
546547 /// called on the same static before.
547- pub fn create_static_alloc ( self , static_id : DefId ) -> AllocId {
548+ pub fn reserve_and_set_static_alloc ( self , static_id : DefId ) -> AllocId {
548549 self . reserve_and_set_dedup ( GlobalAlloc :: Static ( static_id) )
549550 }
550551
551552 /// Generates an `AllocId` for a function. Depending on the function type,
552553 /// this might get deduplicated or assigned a new ID each time.
553- pub fn create_fn_alloc ( self , instance : Instance < ' tcx > ) -> AllocId {
554+ pub fn reserve_and_set_fn_alloc ( self , instance : Instance < ' tcx > ) -> AllocId {
554555 // Functions cannot be identified by pointers, as asm-equal functions can get deduplicated
555556 // by the linker (we set the "unnamed_addr" attribute for LLVM) and functions can be
556557 // duplicated across crates.
@@ -575,7 +576,7 @@ impl<'tcx> TyCtxt<'tcx> {
575576 }
576577
577578 /// Generates an `AllocId` for a (symbolic, not-reified) vtable. Will get deduplicated.
578- pub fn create_vtable_alloc (
579+ pub fn reserve_and_set_vtable_alloc (
579580 self ,
580581 ty : Ty < ' tcx > ,
581582 poly_trait_ref : Option < ty:: PolyExistentialTraitRef < ' tcx > > ,
@@ -588,7 +589,7 @@ impl<'tcx> TyCtxt<'tcx> {
588589 /// Statics with identical content will still point to the same `Allocation`, i.e.,
589590 /// their data will be deduplicated through `Allocation` interning -- but they
590591 /// are different places in memory and as such need different IDs.
591- pub fn create_memory_alloc ( self , mem : ConstAllocation < ' tcx > ) -> AllocId {
592+ pub fn reserve_and_set_memory_alloc ( self , mem : ConstAllocation < ' tcx > ) -> AllocId {
592593 let id = self . reserve_alloc_id ( ) ;
593594 self . set_alloc_id_memory ( id, mem) ;
594595 id
0 commit comments