The ReadLockGuard and WriteLockGuard types implement Deref and DerefMut respectively, but it is not obvious this is safe. For example, by locking the same area of memory at different types, I can get a &usize and an &AtomicUsize which alias, then storing into the &AtomicUsize causes the &usize to become UB.
The
ReadLockGuard
andWriteLockGuard
types implementDeref
andDerefMut
respectively, but it is not obvious this is safe. For example, by locking the same area of memory at different types, I can get a&usize
and an&AtomicUsize
which alias, then storing into the&AtomicUsize
causes the&usize
to become UB.