Skip to content

Commit

Permalink
Fix minor typo in const-ub RFC
Browse files Browse the repository at this point in the history
  • Loading branch information
teor2345 authored May 6, 2021
1 parent 4458001 commit 5b81cdc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion text/3016-const-ub.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ The answer is that in this case, the final value that is currently being execute
For example, when UB arises while computing an array length, then the final array length can be any `usize`, or it can be (partially) uninitialized.
No guarantees are made about this final value, and it can be different depending on host and target architecture, compiler flags, and more.
However, UB will not otherwise adversely affect the currently running compiler; type-checking and lints and everything else will work correctly given whatever the result of the CTFE computation is.
In particular, when the same constant is used in two different crates, those crates will still definitely see the same value for that constant -- everything else would break the type system.
In particular, when the same constant is used in two different crates, those crates will still definitely see the same value for that constant -- anything else would break the type system.

Note, however, that this means compile-time UB can later cause runtime UB when the program is actually executed:
for example, if there is UB while computing the initial value of a `Vec<i32>`, the result might be a completely invalid vector that causes UB at runtime when used in the program.
Expand Down

0 comments on commit 5b81cdc

Please sign in to comment.