Skip to content

Commit d85cdd6

Browse files
committed
Add link definition for const contexts
1 parent c13d0b6 commit d85cdd6

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/behavior-considered-undefined.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ r[undefined.validity.valid-range]
215215
> `rustc` achieves this with the unstable `rustc_layout_scalar_valid_range_*` attributes.
216216
217217
r[undefined.validity.const-provenance]
218-
* **In [const context](const_eval.md#const-context)**: In addition to what is described above, further provenance-related requirements apply during const evaluation. Any value that holds pure integer data (the `i*`/`u*`/`f*` types as well as `bool` and `char`, enum discriminants, and slice metadata) must not carry any provenance. Any value that holds pointer data (references, raw pointers, function pointers, and `dyn Trait` metadata) must either carry no provenance, or all bytes must be fragments of the same original pointer value in the correct order.
218+
* **In [const contexts]**: In addition to what is described above, further provenance-related requirements apply during const evaluation. Any value that holds pure integer data (the `i*`/`u*`/`f*` types as well as `bool` and `char`, enum discriminants, and slice metadata) must not carry any provenance. Any value that holds pointer data (references, raw pointers, function pointers, and `dyn Trait` metadata) must either carry no provenance, or all bytes must be fragments of the same original pointer value in the correct order.
219219

220220
This implies that transmuting or otherwise reinterpreting a pointer (reference, raw pointer, or function pointer) into a non-pointer type (such as integers) is undefined behavior if the pointer had provenance.
221221

@@ -251,6 +251,7 @@ reading uninitialized memory is permitted are inside `union`s and in "padding"
251251
[`bool`]: types/boolean.md
252252
[`const`]: items/constant-items.md
253253
[abi]: items/external-blocks.md#abi
254+
[const contexts]: const-eval.const-context
254255
[`target_feature`]: attributes/codegen.md#the-target_feature-attribute
255256
[`UnsafeCell<U>`]: std::cell::UnsafeCell
256257
[Rustonomicon]: ../nomicon/index.html

0 commit comments

Comments
 (0)