You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> `rustc` achieves this with the unstable `rustc_layout_scalar_valid_range_*` attributes.
223
216
217
+
r[undefined.validity.const-provenance]
218
+
***In [const context](const_eval.md#const-context)**: In addition to what is described above,
219
+
further provenance-related requirements apply during const evaluation.
220
+
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.
221
+
Any value that holds pointer data (references, raw pointers, function pointers, and `dyn Trait` metadata) must either carry no provenance,
222
+
or all bytes must be fragments of the same original pointer value in the correct order.
223
+
224
+
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 of the pointer had provenance.
225
+
224
226
r[undefined.validity.undef]
225
227
**Note:** Uninitialized memory is also implicitly invalid for any type that has
226
228
a restricted set of valid values. In other words, the only cases in which
0 commit comments