Skip to content

Commit 69c3830

Browse files
committedApr 9, 2018
std: Be sure to modify atomics in tests
See rust-lang#49775 for some more information but it looks like this is working around an LLVM bug for the time being. Closes rust-lang#49775
1 parent 4b9b70c commit 69c3830

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed
 

‎src/libcore/tests/atomic.rs

+6-4
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,10 @@ static S_UINT: AtomicUsize = AtomicUsize::new(0);
104104

105105
#[test]
106106
fn static_init() {
107-
assert!(!S_FALSE.load(SeqCst));
108-
assert!(S_TRUE.load(SeqCst));
109-
assert!(S_INT.load(SeqCst) == 0);
110-
assert!(S_UINT.load(SeqCst) == 0);
107+
// Note that we're not really testing the mutability here but it's important
108+
// on Android at the moment (#49775)
109+
assert!(!S_FALSE.swap(true, SeqCst));
110+
assert!(S_TRUE.swap(false, SeqCst));
111+
assert!(S_INT.fetch_add(1, SeqCst) == 0);
112+
assert!(S_UINT.fetch_add(1, SeqCst) == 0);
111113
}

0 commit comments

Comments
 (0)