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:
parent
9bed4fce3c
commit
d7fcf8216a
@ -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>
|
||||
|
Loading…
x
Reference in New Issue
Block a user