Skip to content

Commit 60bef15

Browse files
committed
better language and further clarification
1 parent a90a538 commit 60bef15

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

text/0000-const-ub.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,16 @@ There are some values that Rust needs to compute at compile-time.
2323
This includes the initial value of a `const`/`static`, and array lengths (and more general, const generics).
2424
Computing these initial values is called compile-time function evaluation (CTFE).
2525
CTFE in Rust is very powerful and permits running almost arbitrary Rust code.
26-
This begs the question, what happens when there is `unsafe` code and it causes [Undefined Behavior (UB)][UB]?
26+
This raises the question, what happens when there is `unsafe` code and it causes [Undefined Behavior (UB)][UB]?
2727

2828
The answer depends on the kind of UB: some kinds of UB are guaranteed to be detected,
2929
while other kinds of UB might either be detected, or else evaluation will continue as if the violated UB condition did not exist (i.e., as if this operation was actually defined).
3030
This can change from compiler version to compiler version: CTFE code that causes UB could build fine with one compiler and fail to build with another.
3131

3232
This RFC does not alter the general policy that unsound code is not subject to strict stability guarantees.
3333
In other words, unsafe code may not rely on all future versions of Rust to implement this RFC.
34-
The RFC only helps *consumers* of unsafe code to be sure that right now, all UB during CTFE will be detected or non-consequential.
35-
It does not grant any new possibilities to *authors* of unsafe code.
34+
The RFC only helps *consumers* of unsafe code to be sure that right now, all UB during CTFE will be detected or non-consequential (i.e., evaluation will proceed as if there was no UB).
35+
It does not grant any new possibilities to *authors* of unsafe code; in particular, it is still considered a critical bug for CTFE code to raise UB, and no stability guarantees are made for such code (as is the case with regular runtime code raising UB).
3636

3737
[UB]: https://doc.rust-lang.org/reference/behavior-considered-undefined.html
3838

0 commit comments

Comments
 (0)