File tree 1 file changed +7
-6
lines changed
1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change 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. This allocated object is disjoint from
13
+ all other allocated objects. All references and raw pointers to the static refer to the same
14
+ allocated object . Static items have the ` static ` lifetime, which outlives all other lifetimes in a
15
+ Rust program. Static items do not call [ ` drop ` ] at the end of the program.
16
16
17
17
The static declaration defines a static value in the [ value namespace] of the module or block where it is located.
18
18
19
19
The static initializer is a [ constant expression] evaluated at compile time.
20
- Static initializers may refer to other statics.
20
+ Static initializers may refer to and even read from other statics.
21
+ When reading from mutable statics, they read the initial value of that static.
21
22
22
23
Non-` mut ` static items that contain a type that is not [ interior mutable] may
23
24
be placed in read-only memory.
You can’t perform that action at this time.
0 commit comments