generated from rust-lang/project-group-template
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from lcnr/const-evaluatable-checked
requirements for `const-eval`
- Loading branch information
Showing
1 changed file
with
14 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Const eval requirements | ||
|
||
For this to work, const operations have to be deterministic and | ||
must not depend on any external state, | ||
at least when they are used in the type system. | ||
|
||
Using floats during CTFE is fully determinstic. So using | ||
them inside of the type system is fine. CTFE can however | ||
produce different results than what would happen on real hardware, | ||
but this is not a concern for const generics. | ||
|
||
Other sources of non-determinism are allocations. This non-determinism | ||
must however not be observed during const-evaluation (TODO: link to const-eval). | ||
Any references used in a constant are considered equal if their targets are equal, which is also determistic. (ref [val-trees](https://github.com/rust-lang/rust/issues/72396)) |