1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2025-01-20 21:18:26 +02:00

Mutable statics are generally a bad idea.

This commit is contained in:
Andrew Walbran 2023-01-17 16:21:02 +00:00
parent 9bed4fce3c
commit d7fcf8216a

View File

@ -26,3 +26,10 @@ fn main() {
unsafe { println!("COUNTER: {}", COUNTER); } // Potential data race!
}
```
<details>
Using a mutable static is generally a bad idea, but there are some cases where it might make sense
in low-level `no_std` code, such as implementing a heap allocator or working with some C APIs.
</details>