@@ -180,12 +180,13 @@ aborts the process by executing an illegal instruction.
180
180
181
181
## Const functions
182
182
183
- Functions qualified with the ` const ` keyword are const functions. _ Const
184
- functions_ can be called from within [ const context] s. When called from a const
185
- context, the function is interpreted by the compiler at compile time. The
186
- interpretation happens in the environment of the compilation target and not the
187
- host. So ` usize ` is ` 32 ` bits if you are compiling against a ` 32 ` bit system,
188
- irrelevant of whether you are building on a ` 64 ` bit or a ` 32 ` bit system.
183
+ Functions qualified with the ` const ` keyword are const functions, as are
184
+ [ tuple struct] and [ tuple variant] constructors. _ Const functions_ can be
185
+ called from within [ const context] s. When called from a const context, the
186
+ function is interpreted by the compiler at compile time. The interpretation
187
+ happens in the environment of the compilation target and not the host. So
188
+ ` usize ` is ` 32 ` bits if you are compiling against a ` 32 ` bit system, irrelevant
189
+ of whether you are building on a ` 64 ` bit or a ` 32 ` bit system.
189
190
190
191
If a const function is called outside a [ const context] , it is indistinguishable
191
192
from any other function. You can freely do anything with a const function that
@@ -214,7 +215,9 @@ Exhaustive list of permitted structures in const functions:
214
215
are all permitted.
215
216
216
217
This rule also applies to type parameters of impl blocks that
217
- contain const methods
218
+ contain const methods.
219
+
220
+ This does not apply to tuple struct and tuple variant constructors.
218
221
219
222
* Arithmetic and comparison operators on integers
220
223
* All boolean operators except for ` && ` and ` || ` which are banned since
@@ -389,6 +392,8 @@ fn foo_oof(#[some_inert_attribute] arg: u8) {
389
392
[ _WhereClause_ ] : generics.md#where-clauses
390
393
[ _OuterAttribute_ ] : ../attributes.md
391
394
[ const context ] : ../const_eval.md#const-context
395
+ [ tuple struct ] : structs.md
396
+ [ tuple variant ] : enumerations.md
392
397
[ external block ] : external-blocks.md
393
398
[ path ] : ../paths.md
394
399
[ block ] : ../expressions/block-expr.md
0 commit comments