Skip to content

Commit cbd7e7e

Browse files
committed
clarify
1 parent 50a1829 commit cbd7e7e

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

static.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
# Statics
22

33
Statics (`static`, `static mut`) are the simplest kind of compile-time evaluated data:
4-
The user explicitly requested them to be evaluated at compile-time,
5-
so evaluation errors from computing the initial value of a static are no concern.
6-
They observably get evaluated *once*, with the result being put at some address known at run-time,
7-
so there are no fundamental restrictions on what statics can do.
8-
The compiler checks that statics are `Sync`, justifying sharing their address across threads.
9-
[Constants](const.md) and [promoteds](promotion.md) are not allowed to read from statics,
10-
so their final value does not have have to be [const-valid](const_safety.md) in any meaningful way
11-
(but as of 2019-08, we do check them for validity anyway, to be conservative).
4+
* The user explicitly requested them to be evaluated at compile-time,
5+
so evaluation errors from computing the initial value of a static are no concern
6+
(in other words, [const safety](const_safety.md) is mostly not an issue).
7+
* They observably get evaluated *once*, with the result being put at some address known at run-time,
8+
so there are no fundamental restrictions on what statics can do.
9+
* The compiler checks that statics are `Sync`, justifying sharing their address across threads.
10+
* [Constants](const.md) and [promoteds](promotion.md) are not allowed to read from statics,
11+
so their final value does not have have to be [const-valid](const_safety.md#const-safety-check-on-values) in any meaningful way.
12+
As of 2019-08, we do check them for validity anyway, to be conservative; and indeed constants could be allowed to read from frozen statics.
1213

1314
## `Drop`
1415

0 commit comments

Comments
 (0)