Skip to content

Commit

Permalink
rewording and make different cases for static and const eval context
Browse files Browse the repository at this point in the history
  • Loading branch information
dingxiangfei2009 committed Nov 21, 2024
1 parent 2aa4e88 commit ad06623
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/const_eval.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ r[const-eval.const-expr.path-item]

r[const-eval.const-expr.path-static]
* Paths to [statics] with these restrictions and observations.
* In particular, reads and writes to any `static mut` or [`extern` statics] is not allowed.
* If the evaluation is carried out in an initializer of a `const` item, or inside a `const` block, reads and writes to any `static mut` or [`extern` statics] are not allowed.
* If the evaluation is carried out in an initializer of a `static` item, reads into a `static`, or inside `unsafe` blocks reads into `static mut` are allowed. Reads and writes to `extern` statics are still not allowed.

r[const-eval.const-expr.tuple]
* [Tuple expressions].
Expand Down
1 change: 1 addition & 0 deletions src/items/constant-items.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ const BITS_N_STRINGS: BitsNStrings<'static> = BitsNStrings {
};
```

r[items.const.final-value-immutable]
The final value of a `const` item cannot contain references to anything mutable.

r[items.const.expr-omission]
Expand Down

0 comments on commit ad06623

Please sign in to comment.