@@ -9,7 +9,7 @@ can be evaluated at compile-time.
9
9
Certain forms of expressions, called constant expressions, can be evaluated at
10
10
compile time. In [ const contexts] ( #const-context ) , these are the only allowed
11
11
expressions, and are always evaluated at compile time. In other places, such as
12
- [ ` let ` statements ] ( statements.html#let-statements ) , constant expressions * may*
12
+ [ let statement ] s , constant expressions * may*
13
13
be, but are not guaranteed to be, evaluated at compile time. Behaviors such as
14
14
out of bounds [ array indexing] or [ overflow] are compiler errors if the value
15
15
must be evaluated at compile time (i.e. in const contexts). Otherwise, these
@@ -26,8 +26,13 @@ to be ran.
26
26
* [ Array expressions] .
27
27
* [ Struct] expressions.
28
28
* [ Enum variant] expressions.
29
- * [ Block expressions] , including ` unsafe ` blocks, which only contain items and
30
- possibly a constant tail expression.
29
+ * [ Block expressions] , including ` unsafe ` blocks.
30
+ * [ let statement] s and thus irrefutable [ patterns] , with the caveat that until ` if ` and ` match `
31
+ are implemented, one cannot use both short circuiting operators (` && ` and ` || ` ) and let
32
+ statements within the same constant.
33
+ * [ assignment expressions] ( operator-expr.html#assignment-expressions )
34
+ * [ assignment operator expressions] ( operator-expr.html#compound-assignment-expressions )
35
+ * [ expression statements] ( statements.html#expression-statements )
31
36
* [ Field] expressions.
32
37
* Index expressions, [ array indexing] or [ slice] with a ` usize ` .
33
38
* [ Range expressions] .
@@ -39,7 +44,7 @@ to be ran.
39
44
* [ Grouped] expressions.
40
45
* [ Cast] expressions, except pointer to address and
41
46
function pointer to address casts.
42
- * Calls of const functions and const methods
47
+ * Calls of const functions and const methods.
43
48
44
49
## Const context
45
50
@@ -81,3 +86,5 @@ A _const context_ is one of the following:
81
86
[ dereference operator ] : expressions/operator-expr.html#the-dereference-operator
82
87
[ grouped ] : expressions/grouped-expr.html
83
88
[ cast ] : expressions/operator-expr.html#type-cast-expressions
89
+ [ let statement ] : statements.html#let-statements
90
+ [ patterns ] : patterns.html
0 commit comments