@@ -389,7 +389,7 @@ impl<'s> AllocDecodingSession<'s> {
389
389
trace ! ( "creating fn alloc ID" ) ;
390
390
let instance = ty:: Instance :: decode ( decoder) ;
391
391
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) ;
393
393
alloc_id
394
394
}
395
395
AllocDiscriminant :: VTable => {
@@ -399,15 +399,16 @@ impl<'s> AllocDecodingSession<'s> {
399
399
let poly_trait_ref =
400
400
<Option < ty:: PolyExistentialTraitRef < ' _ > > as Decodable < D > >:: decode ( decoder) ;
401
401
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) ;
403
404
alloc_id
404
405
}
405
406
AllocDiscriminant :: Static => {
406
407
assert ! ( alloc_id. is_none( ) ) ;
407
408
trace ! ( "creating extern static alloc ID" ) ;
408
409
let did = <DefId as Decodable < D > >:: decode ( decoder) ;
409
410
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) ;
411
412
alloc_id
412
413
}
413
414
}
@@ -544,13 +545,13 @@ impl<'tcx> TyCtxt<'tcx> {
544
545
545
546
/// Generates an `AllocId` for a static or return a cached one in case this function has been
546
547
/// 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 {
548
549
self . reserve_and_set_dedup ( GlobalAlloc :: Static ( static_id) )
549
550
}
550
551
551
552
/// Generates an `AllocId` for a function. Depending on the function type,
552
553
/// 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 {
554
555
// Functions cannot be identified by pointers, as asm-equal functions can get deduplicated
555
556
// by the linker (we set the "unnamed_addr" attribute for LLVM) and functions can be
556
557
// duplicated across crates.
@@ -575,7 +576,7 @@ impl<'tcx> TyCtxt<'tcx> {
575
576
}
576
577
577
578
/// 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 (
579
580
self ,
580
581
ty : Ty < ' tcx > ,
581
582
poly_trait_ref : Option < ty:: PolyExistentialTraitRef < ' tcx > > ,
@@ -588,7 +589,7 @@ impl<'tcx> TyCtxt<'tcx> {
588
589
/// Statics with identical content will still point to the same `Allocation`, i.e.,
589
590
/// their data will be deduplicated through `Allocation` interning -- but they
590
591
/// 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 {
592
593
let id = self . reserve_alloc_id ( ) ;
593
594
self . set_alloc_id_memory ( id, mem) ;
594
595
id
0 commit comments