From b4192aa4dfe99c1fe605fd169d7cef4fd972bea9 Mon Sep 17 00:00:00 2001 From: Geoff Yoerger Date: Thu, 19 Jan 2017 20:38:26 -0600 Subject: [PATCH 1/5] Module level doc --- src/libcore/sync/atomic.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/libcore/sync/atomic.rs b/src/libcore/sync/atomic.rs index 7520579447152..484e1181dd2ac 100644 --- a/src/libcore/sync/atomic.rs +++ b/src/libcore/sync/atomic.rs @@ -21,9 +21,10 @@ //! //! Each method takes an `Ordering` which represents the strength of //! the memory barrier for that operation. These orderings are the -//! same as [LLVM atomic orderings][1]. +//! same as [LLVM atomic orderings][1]. For more information see the [nomicon][2] //! //! [1]: http://llvm.org/docs/LangRef.html#memory-model-for-concurrent-operations +//! [2]: https://doc.rust-lang.org/nomicon/atomics.html //! //! Atomic variables are safe to share between threads (they implement `Sync`) //! but they do not themselves provide the mechanism for sharing and follow the From c4c9ff2f00975e00ba56c1b1d309ff1f278f3760 Mon Sep 17 00:00:00 2001 From: Geoff Yoerger Date: Thu, 19 Jan 2017 20:39:54 -0600 Subject: [PATCH 2/5] '.' --- src/libcore/sync/atomic.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libcore/sync/atomic.rs b/src/libcore/sync/atomic.rs index 484e1181dd2ac..ff7abb45d7bfe 100644 --- a/src/libcore/sync/atomic.rs +++ b/src/libcore/sync/atomic.rs @@ -21,7 +21,7 @@ //! //! Each method takes an `Ordering` which represents the strength of //! the memory barrier for that operation. These orderings are the -//! same as [LLVM atomic orderings][1]. For more information see the [nomicon][2] +//! same as [LLVM atomic orderings][1]. For more information see the [nomicon][2]. //! //! [1]: http://llvm.org/docs/LangRef.html#memory-model-for-concurrent-operations //! [2]: https://doc.rust-lang.org/nomicon/atomics.html From 02ead27c935887b148e58df999dbd8fb9be9d789 Mon Sep 17 00:00:00 2001 From: Geoff Yoerger Date: Thu, 19 Jan 2017 20:43:43 -0600 Subject: [PATCH 3/5] Into item level docs (enum Ordering) --- src/libcore/sync/atomic.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/libcore/sync/atomic.rs b/src/libcore/sync/atomic.rs index ff7abb45d7bfe..bd1d00486ec7e 100644 --- a/src/libcore/sync/atomic.rs +++ b/src/libcore/sync/atomic.rs @@ -142,6 +142,8 @@ unsafe impl Sync for AtomicPtr {} /// /// Rust's memory orderings are [the same as /// LLVM's](http://llvm.org/docs/LangRef.html#memory-model-for-concurrent-operations). +/// +/// For more information see the [nomicon](https://doc.rust-lang.org/nomicon/atomics.html). #[stable(feature = "rust1", since = "1.0.0")] #[derive(Copy, Clone, Debug)] pub enum Ordering { From dfa9736e9f5b9e5650fea5faed6dc7d446772eb4 Mon Sep 17 00:00:00 2001 From: Geoff Yoerger Date: Thu, 19 Jan 2017 21:43:34 -0600 Subject: [PATCH 4/5] Clarify the `default` option to use --- src/libcore/sync/atomic.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/libcore/sync/atomic.rs b/src/libcore/sync/atomic.rs index bd1d00486ec7e..3d274d17c7cc4 100644 --- a/src/libcore/sync/atomic.rs +++ b/src/libcore/sync/atomic.rs @@ -140,10 +140,15 @@ unsafe impl Sync for AtomicPtr {} /// to be moved either before or after the atomic operation; on the other end /// "relaxed" atomics allow all reorderings. /// +/// If you are confused or don't have enough time to research which ordering to use, use `SeqCst`. +/// Of all the options it has the most unsurpising effect (see the nomicon for details. [1]) +/// The downside is you miss out on several optimizations the other orderings offer. +/// /// Rust's memory orderings are [the same as /// LLVM's](http://llvm.org/docs/LangRef.html#memory-model-for-concurrent-operations). /// -/// For more information see the [nomicon](https://doc.rust-lang.org/nomicon/atomics.html). +/// For more information see the [nomicon][1]. +/// [1]: https://doc.rust-lang.org/nomicon/atomics.html #[stable(feature = "rust1", since = "1.0.0")] #[derive(Copy, Clone, Debug)] pub enum Ordering { From c0a5b99f01df01341500d4c23a724bddb029a9cb Mon Sep 17 00:00:00 2001 From: Geoff Yoerger Date: Fri, 20 Jan 2017 09:25:03 -0600 Subject: [PATCH 5/5] Revert previous commit --- src/libcore/sync/atomic.rs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/libcore/sync/atomic.rs b/src/libcore/sync/atomic.rs index 3d274d17c7cc4..a3cb12844777b 100644 --- a/src/libcore/sync/atomic.rs +++ b/src/libcore/sync/atomic.rs @@ -140,10 +140,6 @@ unsafe impl Sync for AtomicPtr {} /// to be moved either before or after the atomic operation; on the other end /// "relaxed" atomics allow all reorderings. /// -/// If you are confused or don't have enough time to research which ordering to use, use `SeqCst`. -/// Of all the options it has the most unsurpising effect (see the nomicon for details. [1]) -/// The downside is you miss out on several optimizations the other orderings offer. -/// /// Rust's memory orderings are [the same as /// LLVM's](http://llvm.org/docs/LangRef.html#memory-model-for-concurrent-operations). ///