This review is from Crev, a distributed system for code reviews. To add your review, set up cargo-crev.

0.2.1 (current) Rating: Positive Thoroughness: Medium Understanding: Medium

by yvt on 2021-09-20

This crate provides an atomic cell to store Option<&T>.

This crate is sound and has no known issues. AtomicRef has the correct trait bounds for Sync/Send-ness and employs the minimum memory ordering to make sure that, when a reference that was recently written through was stored to an AtomicRef, whoever loads that reference is guaranteed to observe the value written. (This requires acquire/release synchronization for all loads and stores on AtomicRef. Without it, the reader could observe a stale value, causing an undefined behavior. This was recently reported by #5 and fixed by #6.)


Crates in the crates.io registry are tarball snapshots uploaded by crates' publishers. The registry is not using crates' git repositories. There is absolutely no guarantee that the repository URL declared by the crate belongs to the crate, or that the code in the repository is the code inside the published tarball.

To review the actual code of the crate, it's best to use cargo crev open atomic_ref. Alternatively, you can download the tarball of atomic_ref v0.2.1 or view the source online.