Skip to content

Commit 167d751

Browse files
committed
Explain differences between const functions and const contexts
1 parent 7cc2ee2 commit 167d751

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/const_eval.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,16 @@ A _const fn_ is a function that one is permitted to call from a const context. D
6363
`const` has no effect on any existing uses, it only restricts the types that arguments and the
6464
return type may use, as well as prevent various expressions from being used within it.
6565

66+
Notable features that const contexts have, but const fn haven't are:
67+
68+
* floating point types
69+
* `dyn Trait` types
70+
* generic bounds on generic parameters beyond `Sized`
71+
* dereferencing of raw pointers
72+
* casting raw pointers to integers
73+
* comparing raw pointers
74+
* union field access
75+
6676
[arithmetic]: expressions/operator-expr.md#arithmetic-and-logical-binary-operators
6777
[array expressions]: expressions/array-expr.md
6878
[array indexing]: expressions/array-expr.md#array-and-slice-indexing-expressions

0 commit comments

Comments
 (0)