From: Manish Goregaokar Date: Mon, 9 Jan 2017 14:51:37 +0000 (-0800) Subject: Replace static mut bool with atomicbool X-Git-Tag: archive/raspbian/0.35.0-2+rpi1~3^2^2^2^2^2^2^2~22^2~11^2~45^2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=e35a00a12e2fa29308b9ffe596eed4e94e280186;p=cargo.git Replace static mut bool with atomicbool --- diff --git a/tests/cross-compile.rs b/tests/cross-compile.rs index 874698b34..f408b42ba 100644 --- a/tests/cross-compile.rs +++ b/tests/cross-compile.rs @@ -31,7 +31,7 @@ fn disabled() -> bool { // It's not particularly common to have a cross-compilation setup, so // try to detect that before we fail a bunch of tests through no fault // of the user. - static mut CAN_RUN_CROSS_TESTS: bool = false; + static CAN_RUN_CROSS_TESTS: AtomicBool = ATOMIC_BOOL_INIT; static CHECK: Once = ONCE_INIT; let cross_target = alternate(); @@ -46,13 +46,11 @@ fn disabled() -> bool { .exec_with_output(); if result.is_ok() { - unsafe { - CAN_RUN_CROSS_TESTS = true; - } + CAN_RUN_CROSS_TESTS.store(true, Ordering::SeqCst); } }); - if unsafe { CAN_RUN_CROSS_TESTS } { + if CAN_RUN_CROSS_TESTS.load(Ordering::SeqCst) { // We were able to compile a simple project, so the user has the // necessary std:: bits installed. Therefore, tests should not // be disabled.