Skip to content

Commit 9eead86

Browse files
committed
require implementations to document the 'obvious'
1 parent 60bef15 commit 9eead86

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

text/0000-const-ub.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,10 @@ In rustc, none of this UB will be detected for now.
5656
However, code causing any kind of UB is still considered buggy and not subject to stability guarantees.
5757
Hence, rustc may start detecting more UB in the future.
5858

59-
All of this UB has in common that there is an "obvious" way to continue evaluation even though the program has caused UB:
59+
All of this UB has in common that there is an easy way to continue evaluation even though the program has caused UB:
6060
we can just access the underlying memory despite alignment and/or aliasing rules being violated, and we can just ignore the existence of an invalid value as long as it is not used in some arithmetic, logical or control-flow operation.
61-
There is no guarantee that CTFE detects such UB: evaluation may either fail with an error, or continue with the "obvious" result.
61+
There is no guarantee that CTFE detects such UB: evaluation may either fail with an error, or continue with the some well-defined result.
62+
In the latter case, implementations should document how evaluation will proceed, i.e., how the result is computed.
6263

6364
In particular, the RFC does not mandate whether UB caused by implementation-defined compiler intrinsics (insofar as they are supported by CTFE) is detected.
6465
However, implementations should document for each intrinsic whether UB is detected, and (if UB is ignored for an intrinsic), what the behavior of CTFE will be when UB occurs.

0 commit comments

Comments
 (0)