mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-31 05:26:23 +03:00
15 lines
276 B
Rust
15 lines
276 B
Rust
use std::sync::atomic::{Ordering, AtomicUsize};
|
|
|
|
static mut X: usize = 5;
|
|
static Y: AtomicUsize = AtomicUsize::new(5);
|
|
|
|
fn main() {
|
|
unsafe {
|
|
X = 6;
|
|
assert_eq!(X, 6);
|
|
}
|
|
|
|
Y.store(6, Ordering::Relaxed);
|
|
assert_eq!(Y.load(Ordering::Relaxed), 6);
|
|
}
|