Skip to content

Commit 3e3be42

Browse files
authored
Move const expressions to const_eval
1 parent 6bc96f8 commit 3e3be42

File tree

1 file changed

+0
-35
lines changed

1 file changed

+0
-35
lines changed

src/expressions.md

-35
Original file line numberDiff line numberDiff line change
@@ -229,41 +229,6 @@ Implicit borrows may be taken in the following expressions:
229229
* Operands of [comparison].
230230
* Left operands of the [compound assignment].
231231

232-
## Constant expressions
233-
234-
Certain types of expressions can be evaluated at compile time. These are called
235-
_constant expressions_ and are required in [const contexts]. In
236-
other places, such as in [`let` statements](statements.html#let-statements),
237-
constant expressions may be evaluated at compile time. If errors, such as out
238-
of bounds [array indexing] or [overflow] occurs,
239-
then it is a compiler error if the value must be evaluated at compile time,
240-
otherwise it is just a warning, but the code will most likely panic when run.
241-
242-
The following expressions are constant expressions, so long as any operands are
243-
also constant expressions and do not cause any [`Drop::drop`][destructors] calls
244-
to be ran.
245-
246-
* [Literals].
247-
* [Paths] to [functions](items/functions.html) and constants.
248-
Recursively defining constants is not allowed.
249-
* [Tuple expressions].
250-
* [Array expressions].
251-
* [Struct] expressions.
252-
* [Enum variant] expressions.
253-
* [Block expressions], including `unsafe` blocks, which only contain items and
254-
possibly a constant tail expression.
255-
* [Field] expressions.
256-
* Index expressions, [array indexing] or [slice] with a `usize`.
257-
* [Range expressions].
258-
* [Closure expressions] which don't capture variables from the environment.
259-
* Built in [negation], [arithmetic, logical], [comparison] or [lazy boolean]
260-
operators used on integer and floating point types, `bool` and `char`.
261-
* Shared [borrow]s, except if applied to a type with [interior mutability].
262-
* The [dereference operator].
263-
* [Grouped] expressions.
264-
* [Cast] expressions, except pointer to address and
265-
function pointer to address casts.
266-
267232
## Overloading Traits
268233

269234
Many of the following operators and expressions can also be overloaded for

0 commit comments

Comments
 (0)