Skip to content
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

Let bindings are now available in const contexts #512

Merged
merged 2 commits into from
Jan 17, 2019
Merged
Changes from 1 commit
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
5 changes: 4 additions & 1 deletion src/const_eval.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ can be evaluated at compile-time.
Certain forms of expressions, called constant expressions, can be evaluated at
compile time. In [const contexts](#const-context), these are the only allowed
expressions, and are always evaluated at compile time. In other places, such as
[`let` statements](statements.html#let-statements), constant expressions *may*
[let statement]s, constant expressions *may*
be, but are not guaranteed to be, evaluated at compile time. Behaviors such as
out of bounds [array indexing] or [overflow] are compiler errors if the value
must be evaluated at compile time (i.e. in const contexts). Otherwise, these
Expand Down Expand Up @@ -40,6 +40,7 @@ to be ran.
* [Cast] expressions, except pointer to address and
function pointer to address casts.
* Calls of const functions and const methods
* [let statement]s and thus irrefutable [patterns]
Centril marked this conversation as resolved.
Show resolved Hide resolved

## Const context

Expand Down Expand Up @@ -81,3 +82,5 @@ A _const context_ is one of the following:
[dereference operator]: expressions/operator-expr.html#the-dereference-operator
[grouped]: expressions/grouped-expr.html
[cast]: expressions/operator-expr.html#type-cast-expressions
[let statement]: statements.html#let-statements
[patterns]: patterns.html