-
Notifications
You must be signed in to change notification settings - Fork 13.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding links for Atomics docs #29377 #40871
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @steveklabnik (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you so much! I have some small nits to make the formatting fall in line with some of our conventions, and one bugfix. 🎊
src/libcore/sync/atomic.rs
Outdated
//! atomically-reference-counted shared pointer). | ||
//! | ||
//! [`Sync`]: ../../marker/trait.Sync.html | ||
//! [arc]: ../struct.Arc.html |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://travis-ci.org/rust-lang/rust/jobs/215789767#L8942 (It says this link is broken.)
The reason for this is that these docs also get rendered for libcore
, not just libstd
. So can you change it to ../../../std/sync/struct.Arc.html
? Tricky!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I had some issues with this one. I wasn't sure if a longer path was better for this to get linked in both place correctly. I'll play around it some more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For now it is, yeah. Someday...
src/libcore/sync/atomic.rs
Outdated
@@ -149,21 +159,26 @@ unsafe impl<T> Sync for AtomicPtr<T> {} | |||
#[derive(Copy, Clone, Debug)] | |||
pub enum Ordering { | |||
/// No ordering constraints, only atomic operations. Corresponds to LLVM's | |||
/// `Monotonic` ordering. | |||
/// [`Monotonic`][1] ordering. | |||
/// [1]: http://llvm.org/docs/Atomics.html#monotonic |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While you're here, would you mind helping with a minor formatting issue as well? This should look like this:
/// No ordering constraints, only atomic operations.
///
/// Corresponds to LLVM's [`Monotonic`] ordering.
///
/// [`Monotonic`]: http://llvm.org/docs/Atomics.html#monotonic
Thanks 😄
src/libcore/sync/atomic.rs
Outdated
/// on the same value. | ||
/// [1]: http://llvm.org/docs/Atomics.html#acquire |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar here, could this be
/// to the other threads that perform a load with [`Acquire`] ordering
/// on the same value.
///
/// [`Aquire`]: http://llvm.org/docs/Atomics.html#acquire
src/libcore/sync/atomic.rs
Outdated
/// in other threads. | ||
/// [1]: http://llvm.org/docs/Atomics.html#release |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
src/libcore/sync/atomic.rs
Outdated
/// When coupled with a load, uses [`Acquire`][1] ordering, and with a store | ||
/// [`Release`][2] ordering. | ||
/// [1]: http://llvm.org/docs/Atomics.html#acquire | ||
/// [2]: http://llvm.org/docs/Atomics.html#release |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and here:
/// When coupled with a load, uses [`Acquire`] ordering, and with a store
/// [`Release`] ordering.
///
/// [`Acquire`]: http://llvm.org/docs/Atomics.html#acquire
/// [`Release`]: http://llvm.org/docs/Atomics.html#release
@@ -250,7 +266,7 @@ impl AtomicBool { | |||
/// | |||
/// [`Ordering`]: enum.Ordering.html | |||
/// [`Release`]: enum.Ordering.html#variant.Release | |||
/// [`AcqRel`]: enum.Ordering.html#variant.Release | |||
/// [`AcqRel`]: enum.Ordering.html#variant.AcqRel |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice catch! 😓
src/libcore/sync/atomic.rs
Outdated
@@ -298,7 +317,7 @@ impl AtomicBool { | |||
|
|||
/// Stores a value into the bool, returning the old value. | |||
/// | |||
/// `swap` takes an [`Ordering`] argument which describes the memory ordering | |||
/// `swap()` takes an [`Ordering`] argument which describes the memory ordering |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
src/libcore/sync/atomic.rs
Outdated
@@ -324,7 +343,7 @@ impl AtomicBool { | |||
/// The return value is always the previous value. If it is equal to `current`, then the value | |||
/// was updated. | |||
/// | |||
/// `compare_and_swap` also takes an [`Ordering`] argument which describes the memory | |||
/// `compare_and_swap()` also takes an [`Ordering`] argument which describes the memory |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and here (I'll stop now, but all the others too)
src/libcore/sync/atomic.rs
Outdated
/// ordering of this operation. The first describes the required ordering if the operation | ||
/// succeeds while the second describes the required ordering when the operation fails. The | ||
/// failure ordering can't be [`Release`] or [`AcqRel`] and must be equivalent or | ||
/// weaker than the success ordering. | ||
/// | ||
/// [`compare_exchange()`]: #method.compare_exchange |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
when removing the ()
s this one will have to go too
src/libcore/sync/atomic.rs
Outdated
/// | ||
/// [`Acquire`]: enum.Ordering.html#variant.Acquire | ||
/// [`AcqRel`]: enum.Ordering.html#variant.AcqRel | ||
/// |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you remove this extra line please?
@steveklabnik I've pushed a new commit for the formatting changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bors: r+ rollup
thanks so much!
📌 Commit 4ea03c8 has been approved by |
Adding links for Atomics docs rust-lang#29377 r? @steveklabnik This should be good for `std::sync::atomic`. The other pages still need more (examples, etc.).
Adding links for Atomics docs rust-lang#29377 r? @steveklabnik This should be good for `std::sync::atomic`. The other pages still need more (examples, etc.).
r? @steveklabnik
This should be good for
std::sync::atomic
. The other pages still need more (examples, etc.).