Skip to content

Commit

Permalink
Rust 1.46 now allows more features in const fn
Browse files Browse the repository at this point in the history
  • Loading branch information
jrincayc committed Sep 6, 2020
1 parent 66b4d58 commit a9549b0
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/items/functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -223,15 +223,16 @@ Exhaustive list of permitted structures in const functions:
This does not apply to tuple struct and tuple variant constructors.

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

0 comments on commit a9549b0

Please sign in to comment.