@@ -369,16 +369,16 @@ impl ObservationLog {
369
369
self . write_location ( new_location) ;
370
370
self . write_action ( & Action :: Acquisition {
371
371
older_rank : older_lock. rank . bit . number ( ) ,
372
- older_location : std :: ptr :: from_ref ( older_lock. location ) as usize ,
372
+ older_location : addr ( older_lock. location ) ,
373
373
newer_rank : new_rank. bit . number ( ) ,
374
- newer_location : std :: ptr :: from_ref ( new_location) as usize ,
374
+ newer_location : addr ( new_location) ,
375
375
} ) ;
376
376
}
377
377
378
378
fn write_location ( & mut self , location : & ' static Location < ' static > ) {
379
379
if self . locations_seen . insert ( location) {
380
380
self . write_action ( & Action :: Location {
381
- address : std :: ptr :: from_ref ( location) as usize ,
381
+ address : addr ( location) ,
382
382
file : location. file ( ) ,
383
383
line : location. line ( ) ,
384
384
column : location. column ( ) ,
@@ -473,3 +473,8 @@ impl LockRankSet {
473
473
self . bits ( ) . trailing_zeros ( )
474
474
}
475
475
}
476
+
477
+ /// Convenience for `std::ptr::from_ref(t) as usize`.
478
+ fn addr < T > ( t : & T ) -> usize {
479
+ std:: ptr:: from_ref ( t) as usize
480
+ }
0 commit comments