Skip to content

Commit

Permalink
apply suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
dingxiangfei2009 committed Dec 2, 2024
1 parent 911b16f commit b086fc0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/const_eval.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,16 @@ r[const-eval.const-expr.path-item]
Recursively defining constants is not allowed.

r[const-eval.const-expr.path-static]
* Paths to [statics] with these restrictions and observations.
* Paths to [statics] with these restrictions.
* Writes to `static` items are not allowed in any constant evaluation context.
* Reads from `extern` statics are not allowed in any constant evaluation context.
* If the evaluation is *not* carried out in an initializer of a `static` item,
then reads from any mutable `static` are not allowed.
A mutable `static` is a `static mut` item, or a `static` item with an interior-mutable type.

These requirements are checked only when the constant is evaluated.
In other words, having such accessed syntactically occur in const contexts is allowed as long as they never get executed.

r[const-eval.const-expr.tuple]
* [Tuple expressions].

Expand Down

0 comments on commit b086fc0

Please sign in to comment.