const AtomicUsize seems not works, does it works by design?
I think there should be some compiling error or warnings， otherwise it can be used by mistake easily
const C: AtomicU32 = AtomicU32::new(0);
assert_eq!(C.fetch_add(1, SeqCst), 1); //always 0
static there, not const.
That's a known gotcha: https://github.com/rust-lang/rust/issues/40543
Clippy seems to have a warning nowadays. Running clippy on the provided playground produces one.
This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.