diff options
| author | Dylan DPC <99973273+Dylan-DPC@users.noreply.github.com> | 2022-05-25 07:31:42 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-05-25 07:31:42 +0200 |
| commit | fbb17777fee8048c3bce9019ef1c1e7e42bb303b (patch) | |
| tree | b920f1805c39a1f43e413b0e7c9cf4313fef5393 | |
| parent | bbb88eaceaf06a654c38620b9ec922cee5c10922 (diff) | |
| parent | d11667f5ccf148270362fb9a5cf39ed06eff7374 (diff) | |
| download | rust-fbb17777fee8048c3bce9019ef1c1e7e42bb303b.tar.gz rust-fbb17777fee8048c3bce9019ef1c1e7e42bb303b.zip | |
Rollup merge of #97026 - Nilstrieb:make-atomic-debug-relaxed, r=scottmcm
Change orderings of `Debug` for the Atomic types to `Relaxed`. This reduces synchronization between threads when debugging the atomic types. Reducing the synchronization means that executions with and without the debug calls will be more consistent, making it easier to debug. We discussed this on the Rust Community Discord with `@ibraheemdev` before.
| -rw-r--r-- | library/core/src/sync/atomic.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/library/core/src/sync/atomic.rs b/library/core/src/sync/atomic.rs index 36df5c3beb3..43cfb1bb640 100644 --- a/library/core/src/sync/atomic.rs +++ b/library/core/src/sync/atomic.rs @@ -1517,7 +1517,7 @@ macro_rules! atomic_int { #[$stable_debug] impl fmt::Debug for $atomic_type { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - fmt::Debug::fmt(&self.load(Ordering::SeqCst), f) + fmt::Debug::fmt(&self.load(Ordering::Relaxed), f) } } @@ -2996,7 +2996,7 @@ pub fn compiler_fence(order: Ordering) { #[stable(feature = "atomic_debug", since = "1.3.0")] impl fmt::Debug for AtomicBool { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - fmt::Debug::fmt(&self.load(Ordering::SeqCst), f) + fmt::Debug::fmt(&self.load(Ordering::Relaxed), f) } } @@ -3004,7 +3004,7 @@ impl fmt::Debug for AtomicBool { #[stable(feature = "atomic_debug", since = "1.3.0")] impl<T> fmt::Debug for AtomicPtr<T> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - fmt::Debug::fmt(&self.load(Ordering::SeqCst), f) + fmt::Debug::fmt(&self.load(Ordering::Relaxed), f) } } |
