From 8bbe676a6cfadd97a6093244087451e55bf84cce Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Sun, 25 Sep 2022 22:04:33 +0200 Subject: [PATCH] mention the extra const UB --- src/behavior-considered-undefined.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/behavior-considered-undefined.md b/src/behavior-considered-undefined.md index e810e8c0d..39461bc9e 100644 --- a/src/behavior-considered-undefined.md +++ b/src/behavior-considered-undefined.md @@ -60,6 +60,10 @@ code. > `rustc_layout_scalar_valid_range_*` attributes. * Incorrect use of inline assembly. For more details, refer to the [rules] to follow when writing code that uses inline assembly. +* **In `const` context** (i.e., during the evaluation of a `const`/`static` + initializer, array length, enum discriminant, or const generic value): + transmuting or otherwise reinterpreting a pointer into some allocated object + as an integer or other non-pointer type. **Note:** Uninitialized memory is also implicitly invalid for any type that has a restricted set of valid values. In other words, the only cases in which