@@ -447,14 +447,14 @@ impl<'tcx> TyCtxt<'tcx> {
447447 ///
448448 /// Make sure to call `set_alloc_id_memory` or `set_alloc_id_same_memory` before returning such
449449 /// an `AllocId` from a query.
450- pub fn reserve_alloc_id ( & self ) -> AllocId {
450+ pub fn reserve_alloc_id ( self ) -> AllocId {
451451 self . alloc_map . lock ( ) . reserve ( )
452452 }
453453
454454 /// Reserves a new ID *if* this allocation has not been dedup-reserved before.
455455 /// Should only be used for function pointers and statics, we don't want
456456 /// to dedup IDs for "real" memory!
457- fn reserve_and_set_dedup ( & self , alloc : GlobalAlloc < ' tcx > ) -> AllocId {
457+ fn reserve_and_set_dedup ( self , alloc : GlobalAlloc < ' tcx > ) -> AllocId {
458458 let mut alloc_map = self . alloc_map . lock ( ) ;
459459 match alloc {
460460 GlobalAlloc :: Function ( ..) | GlobalAlloc :: Static ( ..) => { }
@@ -472,13 +472,13 @@ impl<'tcx> TyCtxt<'tcx> {
472472
473473 /// Generates an `AllocId` for a static or return a cached one in case this function has been
474474 /// called on the same static before.
475- pub fn create_static_alloc ( & self , static_id : DefId ) -> AllocId {
475+ pub fn create_static_alloc ( self , static_id : DefId ) -> AllocId {
476476 self . reserve_and_set_dedup ( GlobalAlloc :: Static ( static_id) )
477477 }
478478
479479 /// Generates an `AllocId` for a function. Depending on the function type,
480480 /// this might get deduplicated or assigned a new ID each time.
481- pub fn create_fn_alloc ( & self , instance : Instance < ' tcx > ) -> AllocId {
481+ pub fn create_fn_alloc ( self , instance : Instance < ' tcx > ) -> AllocId {
482482 // Functions cannot be identified by pointers, as asm-equal functions can get deduplicated
483483 // by the linker (we set the "unnamed_addr" attribute for LLVM) and functions can be
484484 // duplicated across crates.
@@ -507,7 +507,7 @@ impl<'tcx> TyCtxt<'tcx> {
507507 /// Statics with identical content will still point to the same `Allocation`, i.e.,
508508 /// their data will be deduplicated through `Allocation` interning -- but they
509509 /// are different places in memory and as such need different IDs.
510- pub fn create_memory_alloc ( & self , mem : & ' tcx Allocation ) -> AllocId {
510+ pub fn create_memory_alloc ( self , mem : & ' tcx Allocation ) -> AllocId {
511511 let id = self . reserve_alloc_id ( ) ;
512512 self . set_alloc_id_memory ( id, mem) ;
513513 id
@@ -519,7 +519,7 @@ impl<'tcx> TyCtxt<'tcx> {
519519 /// This function exists to allow const eval to detect the difference between evaluation-
520520 /// local dangling pointers and allocations in constants/statics.
521521 #[ inline]
522- pub fn get_global_alloc ( & self , id : AllocId ) -> Option < GlobalAlloc < ' tcx > > {
522+ pub fn get_global_alloc ( self , id : AllocId ) -> Option < GlobalAlloc < ' tcx > > {
523523 self . alloc_map . lock ( ) . alloc_map . get ( & id) . cloned ( )
524524 }
525525
@@ -529,7 +529,7 @@ impl<'tcx> TyCtxt<'tcx> {
529529 /// constants (as all constants must pass interning and validation that check for dangling
530530 /// ids), this function is frequently used throughout rustc, but should not be used within
531531 /// the miri engine.
532- pub fn global_alloc ( & self , id : AllocId ) -> GlobalAlloc < ' tcx > {
532+ pub fn global_alloc ( self , id : AllocId ) -> GlobalAlloc < ' tcx > {
533533 match self . get_global_alloc ( id) {
534534 Some ( alloc) => alloc,
535535 None => bug ! ( "could not find allocation for {}" , id) ,
@@ -538,15 +538,15 @@ impl<'tcx> TyCtxt<'tcx> {
538538
539539 /// Freezes an `AllocId` created with `reserve` by pointing it at an `Allocation`. Trying to
540540 /// call this function twice, even with the same `Allocation` will ICE the compiler.
541- pub fn set_alloc_id_memory ( & self , id : AllocId , mem : & ' tcx Allocation ) {
541+ pub fn set_alloc_id_memory ( self , id : AllocId , mem : & ' tcx Allocation ) {
542542 if let Some ( old) = self . alloc_map . lock ( ) . alloc_map . insert ( id, GlobalAlloc :: Memory ( mem) ) {
543543 bug ! ( "tried to set allocation ID {}, but it was already existing as {:#?}" , id, old) ;
544544 }
545545 }
546546
547547 /// Freezes an `AllocId` created with `reserve` by pointing it at an `Allocation`. May be called
548548 /// twice for the same `(AllocId, Allocation)` pair.
549- fn set_alloc_id_same_memory ( & self , id : AllocId , mem : & ' tcx Allocation ) {
549+ fn set_alloc_id_same_memory ( self , id : AllocId , mem : & ' tcx Allocation ) {
550550 self . alloc_map . lock ( ) . alloc_map . insert_same ( id, GlobalAlloc :: Memory ( mem) ) ;
551551 }
552552}
0 commit comments