From: Ralf Jung Date: Fri, 20 Jul 2018 07:05:58 +0000 (+0200) Subject: more information on determinism of CTFE X-Git-Url: https://git.ralfj.de/web.git/commitdiff_plain/8f7d0f652177ae7f7a8a1470025c1cc53e710058?ds=inline;hp=71c242c914e795caec8e66e0eecd96864103dd1f more information on determinism of CTFE --- diff --git a/personal/_posts/2018-07-19-const.md b/personal/_posts/2018-07-19-const.md index 23e9325..2bcd009 100644 --- a/personal/_posts/2018-07-19-const.md +++ b/personal/_posts/2018-07-19-const.md @@ -39,6 +39,7 @@ Clearly, we don't want CTFE to have actually observable side-effects outside of In fact, just naively letting programs read files would also be grossly unsafe: When computing the length of an array twice, it is important that we obtain the same result. +**Update:** As @eddyb points out, things get even worse once you consider const generics, traits, and coherence: At that point, you have to [rely on evaluating the same expression in different crates to produce the same result](https://internals.rust-lang.org/t/mir-constant-evaluation/3143/47). **/Update** > *CTFE must be deterministic.*