|
8 | 8 | > [^extern-safety]: The `safe` and `unsafe` function qualifiers are only
|
9 | 9 | > allowed semantically within `extern` blocks.
|
10 | 10 |
|
11 |
| -A *static item* is similar to a [constant], except that it represents a precise |
12 |
| -memory location in the program. All references to the static refer to the same |
13 |
| -memory location. Static items have the `static` lifetime, which outlives all |
14 |
| -other lifetimes in a Rust program. Static items do not call [`drop`] at the |
15 |
| -end of the program. |
| 11 | +A *static item* is similar to a [constant], except that it represents an allocated object in the |
| 12 | +program that is initialized with the initializer expression. All references and raw pointers to the |
| 13 | +static refer to the same allocated object. Static items have the `static` lifetime, which outlives |
| 14 | +all other lifetimes in a Rust program. Static items do not call [`drop`] at the end of the program. |
| 15 | + |
| 16 | +This allocated object is disjoint from all other `static` objects as well as heap-allocated and |
| 17 | +stack-allocated variables. However, the storage of immutable `static` items can overlap with objects |
| 18 | +that do not themselves have a unique address, such as promoteds and `const` items. |
16 | 19 |
|
17 | 20 | The static declaration defines a static value in the [value namespace] of the module or block where it is located.
|
18 | 21 |
|
19 | 22 | The static initializer is a [constant expression] evaluated at compile time.
|
20 |
| -Static initializers may refer to other statics. |
| 23 | +Static initializers may refer to and even read from other statics. |
| 24 | +When reading from mutable statics, they read the initial value of that static. |
21 | 25 |
|
22 | 26 | Non-`mut` static items that contain a type that is not [interior mutable] may
|
23 | 27 | be placed in read-only memory.
|
|
0 commit comments