Skip to content

Commit b14d000

Browse files
committed
Rust 1.46 now allows more features in const fn
1 parent 25391db commit b14d000

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/items/functions.md

+4-3
Original file line numberDiff line numberDiff line change
@@ -223,15 +223,16 @@ Exhaustive list of permitted structures in const functions:
223223
This does not apply to tuple struct and tuple variant constructors.
224224

225225
* Arithmetic and comparison operators on integers
226-
* All boolean operators except for `&&` and `||` which are banned since
227-
they are short-circuiting.
226+
* All boolean operators including `&&` and `||`
228227
* Any kind of aggregate constructor (array, `struct`, `enum`, tuple, ...)
229228
* Calls to other *safe* const functions (whether by function call or method call)
230229
* Index expressions on arrays and slices
231230
* Field accesses on structs and tuples
232231
* Reading from constants (but not statics, not even taking a reference to a static)
233232
* `&` and `*` (only dereferencing of references, not raw pointers)
234-
* Casts except for raw pointer to integer casts
233+
* `if`, `if let`, and `match`
234+
* `while`, `while let`, and `loop`
235+
* Casts except for raw pointer to integer casts and cast to slice
235236
* `unsafe` blocks and `const unsafe fn` are allowed, but the body/block may only do
236237
the following unsafe operations:
237238
* calls to const unsafe functions

0 commit comments

Comments
 (0)