mirror of
https://github.com/gfx-rs/wgpu.git
synced 2025-02-16 08:53:20 +00:00
refactor: lock::observing
: extract fn addr
from ref. conv. to usize
This commit is contained in:
parent
63a24d37c3
commit
ec21000521
@ -369,16 +369,16 @@ impl ObservationLog {
|
||||
self.write_location(new_location);
|
||||
self.write_action(&Action::Acquisition {
|
||||
older_rank: older_lock.rank.bit.number(),
|
||||
older_location: std::ptr::from_ref(older_lock.location) as usize,
|
||||
older_location: addr(older_lock.location),
|
||||
newer_rank: new_rank.bit.number(),
|
||||
newer_location: std::ptr::from_ref(new_location) as usize,
|
||||
newer_location: addr(new_location),
|
||||
});
|
||||
}
|
||||
|
||||
fn write_location(&mut self, location: &'static Location<'static>) {
|
||||
if self.locations_seen.insert(location) {
|
||||
self.write_action(&Action::Location {
|
||||
address: std::ptr::from_ref(location) as usize,
|
||||
address: addr(location),
|
||||
file: location.file(),
|
||||
line: location.line(),
|
||||
column: location.column(),
|
||||
@ -473,3 +473,8 @@ impl LockRankSet {
|
||||
self.bits().trailing_zeros()
|
||||
}
|
||||
}
|
||||
|
||||
/// Convenience for `std::ptr::from_ref(t) as usize`.
|
||||
fn addr<T>(t: &T) -> usize {
|
||||
std::ptr::from_ref(t) as usize
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user