Skip to content

const_eval: we allow references to statics and promoteds #1858

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 17, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/const_eval.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,9 @@ r[const-eval.const-expr.builtin-arith-logic]
r[const-eval.const-expr.borrows]
* All forms of [borrow]s, including raw borrows, with one limitation:
mutable borrows and shared borrows to values with interior mutability
are only allowed to refer to *transient* places. A place is *transient*
are only allowed to refer to *transient* places or to *static* places. A place is *transient*
if its lifetime is strictly contained inside the current [const context].
A place is *static* if it is a `static` item or a [promoted expression].

r[const-eval.const-expr.deref]
* The [dereference operator] except for raw pointers.
Expand Down Expand Up @@ -195,6 +196,7 @@ of whether you are building on a `64` bit or a `32` bit system.
[overflow]: expressions/operator-expr.md#overflow
[paths]: expressions/path-expr.md
[patterns]: patterns.md
[promoted expression]: destructors.md#constant-promotion
[range expressions]: expressions/range-expr.md
[slice]: types/slice.md
[statics]: items/static-items.md
Expand Down