What is wrong with this code?
use std::sync::atomic::AtomicUsize; static mut counter: AtomicUsize = AtomicUsize::new(0); fn main() {}
I get this error:
error: const fns are an unstable feature --> src/main.rs:3:35 |> 3 |> static mut counter: AtomicUsize = AtomicUsize::new(0); |> ^^^^^^^^^^^^^^^^^^^ help: in Nightly builds, add `#![feature(const_fn)]` to the crate attributes to enable
The docs mention that other atomic sizes are unstable, but AtomicUsize seems to be stable.
The goal of this is to get an atomic counter for each process.
source share