rust-lang / nomicon

The Dark Arts of Advanced and Unsafe Rust Programming
https://doc.rust-lang.org/nomicon/
Apache License 2.0
1.74k stars 256 forks source link

Improve wording and description of atomics in the `Arc` chapter #430

Open ThePuzzlemaker opened 7 months ago

ThePuzzlemaker commented 7 months ago

I attempted my best to improve my original description of atomics. This removes the giant ugly double-blockquote referencing the Rust alloc crate, which references the Boost documentation. Please let me know if my descriptions are wrong!

I also fixed #323 with this edit; it didn't really make sense anyway to have it be a *mut ArcInner<T> originally as it wouldn't have been possible to mutate the inner value or the refcount (the refcount can be updated through a shared ref with atomics, anyway). I made sure to keep the description of variance, so the reader understands why that is an important property to retain.