diff --git a/tests/run-pass/atomic.rs b/tests/run-pass/atomic.rs index 4871aa9fe0f6..66d25ca01ea9 100644 --- a/tests/run-pass/atomic.rs +++ b/tests/run-pass/atomic.rs @@ -88,13 +88,13 @@ fn atomic_fences() { } fn weak_sometimes_fails() { - static ATOMIC: AtomicBool = AtomicBool::new(false); + let atomic = AtomicBool::new(false); let tries = 20; for _ in 0..tries { - let cur = ATOMIC.load(Relaxed); + let cur = atomic.load(Relaxed); // Try (weakly) to flip the flag. - if ATOMIC.compare_exchange_weak(cur, !cur, Relaxed, Relaxed).is_err() { - // We succeeded, so return and skip the panic. + if atomic.compare_exchange_weak(cur, !cur, Relaxed, Relaxed).is_err() { + // We failed, so return and skip the panic. return; } }