I tried this code: https://play.rust-lang.org/?version=stable&mode=debug&edition=2024&gist=139b1c685d63e315c4e7140bcfc6694f
use std::sync::atomic::{AtomicBool, Ordering};
fn main() {
const ATOMIC_BOOL: AtomicBool = AtomicBool::new(true);
ATOMIC_BOOL.store(false, Ordering::SeqCst);
eprintln!("ATOMIC_BOOL == {}", ATOMIC_BOOL.load(Ordering::SeqCst));
}
I expected to see this happen:
Either fail to compile, or compile with warning, or print ATOMIC_BOOL == false
Instead, this happened:
Compiled without any warnings, output is ATOMIC_BOOL == false, which is unexpected.
Meta
rustc --version --verbose:
rustc 1.89.0 (29483883e 2025-08-04) (Fedora 1.89.0-2.fc42)
binary: rustc
commit-hash: 29483883eed69d5fb4db01964cdf2af4d86e9cb2
commit-date: 2025-08-04
host: x86_64-unknown-linux-gnu
release: 1.89.0
LLVM version: 20.1.8
P.S. There is a Clippy lint about this, but I believe that it should be a rustc warning instead.
I tried this code: https://play.rust-lang.org/?version=stable&mode=debug&edition=2024&gist=139b1c685d63e315c4e7140bcfc6694f
I expected to see this happen:
Either fail to compile, or compile with warning, or print
ATOMIC_BOOL == falseInstead, this happened:
Compiled without any warnings, output is
ATOMIC_BOOL == false, which is unexpected.Meta
rustc --version --verbose:P.S. There is a Clippy lint about this, but I believe that it should be a rustc warning instead.