Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Explain differences between const functions and const contexts
  • Loading branch information
oli-obk committed Jul 1, 2020
commit 167d75106949fcd83eb6925ee91a0b6e15fcc7a4
10 changes: 10 additions & 0 deletions src/const_eval.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,16 @@ A _const fn_ is a function that one is permitted to call from a const context. D
`const` has no effect on any existing uses, it only restricts the types that arguments and the
return type may use, as well as prevent various expressions from being used within it.

Notable features that const contexts have, but const fn haven't are:

* floating point types
* `dyn Trait` types
* generic bounds on generic parameters beyond `Sized`
* dereferencing of raw pointers
* casting raw pointers to integers
* comparing raw pointers
* union field access

[arithmetic]: expressions/operator-expr.md#arithmetic-and-logical-binary-operators
[array expressions]: expressions/array-expr.md
[array indexing]: expressions/array-expr.md#array-and-slice-indexing-expressions
Expand Down