We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b6eccc6 commit efd2d55Copy full SHA for efd2d55
tests/run-pass/atomic.rs
@@ -88,13 +88,13 @@ fn atomic_fences() {
88
}
89
90
fn weak_sometimes_fails() {
91
- static ATOMIC: AtomicBool = AtomicBool::new(false);
+ let atomic = AtomicBool::new(false);
92
let tries = 20;
93
for _ in 0..tries {
94
- let cur = ATOMIC.load(Relaxed);
+ let cur = atomic.load(Relaxed);
95
// Try (weakly) to flip the flag.
96
- if ATOMIC.compare_exchange_weak(cur, !cur, Relaxed, Relaxed).is_err() {
97
- // 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.
98
return;
99
100
0 commit comments