From 61f608248b73c9a2721e484724e59ed07fb94989 Mon Sep 17 00:00:00 2001 From: Keno Fischer Date: Tue, 9 May 2023 13:10:11 -0400 Subject: [PATCH] Explicitly note that :consistent includes no-ub (#49693) * Explicitly note that :consistent includes no-ub We may split these effects in the future, but currently :consistent-cy requires the absence for undefined behavior for the function. There were a few questions about this, so explicitly document this in the help text. * Update base/expr.jl Co-authored-by: Sukera <11753998+Seelengrab@users.noreply.github.com> --------- Co-authored-by: Shuhei Kadowaki <40514306+aviatesk@users.noreply.github.com> Co-authored-by: Sukera <11753998+Seelengrab@users.noreply.github.com> --- base/expr.jl | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/base/expr.jl b/base/expr.jl index c37f1a6482162..e45684f95a34f 100644 --- a/base/expr.jl +++ b/base/expr.jl @@ -513,6 +513,13 @@ The `:consistent` setting asserts that for egal (`===`) inputs: even for the same world age (e.g. because one ran in the interpreter, while the other was optimized). +!!! note + The `:consistent`-cy assertion currrently includes the assertion that the function + will not execute any undefined behavior (for any input). Note that undefined behavior + may technically cause the function to violate other effect assertions (such as + `:nothrow` or `:effect_free`) as well, but we do not model this, and all effects + except `:consistent` assume the absence of undefined behavior. + !!! note If `:consistent` functions terminate by throwing an exception, that exception itself is not required to meet the egality requirement specified above.