mirror of
https://github.com/google/comprehensive-rust.git
synced 2025-04-25 16:54:32 +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!
|
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