diff --git a/src/behavior-considered-undefined.md b/src/behavior-considered-undefined.md index ff34d0af28..5635fb16d6 100644 --- a/src/behavior-considered-undefined.md +++ b/src/behavior-considered-undefined.md @@ -139,17 +139,17 @@ r[undefined.validity.enum] * An `enum` must have a valid discriminant, and all fields of the variant indicated by that discriminant must be valid at their respective type. r[undefined.validity.struct] -* A `struct`, tuple, and array requires all fields/elements to be valid at their respective type. +* A `struct`, tuple, or array requires all fields/elements to be valid at their respective type. r[undefined.validity.union] * For a `union`, the exact validity requirements are not decided yet. Obviously, all values that can be created entirely in safe code are valid. If the union has a [zero-sized] field, then every possible value is valid. Further details are [still being debated](https://github.com/rust-lang/unsafe-code-guidelines/issues/438). r[undefined.validity.reference-box] -* A reference or [`Box`] must be aligned and non-null, it cannot be [dangling], and it must point to a valid value (in case of dynamically sized types, using the actual dynamic type of the pointee as determined by the [metadata]). Note that the last point (about pointing to a valid value) remains a subject of some debate. +* A reference or [`Box`] must be aligned and non-null, it cannot be [dangling], and it must point to a valid value (in case of dynamically sized types, using the actual dynamic type of the pointee as determined by the [metadata]). Note that the last point (about pointing to a valid value) remains a subject of [some debate](https://github.com/rust-lang/unsafe-code-guidelines/issues/414). r[undefined.validity.wide] * The [metadata] of a wide reference, [`Box`], or raw pointer must match the type of the [unsized tail]: - * `dyn Trait` metadata must be a pointer to a compiler-generated vtable for `Trait`. (For raw pointers, this requirement remains a subject of some debate.) + * `dyn Trait` metadata must be a pointer to a compiler-generated vtable for `Trait`. (For raw pointers, this requirement remains a subject of [some debate](https://github.com/rust-lang/unsafe-code-guidelines/issues/516).) * Slice (`[T]`) and `str` metadata must be a valid `usize`. In addition, for a wide reference or [`Box`], the metadata is invalid if it makes the total size of the pointed-to value (as determined by `size_of_val`) bigger than `isize::MAX`. @@ -161,7 +161,7 @@ r[undefined.validity.valid-range] * If a type has a custom range of valid values, then a valid value must be in that range. In the standard library, this affects [`NonNull`] and [`NonZero`]. > [!NOTE] - > `rustc` achieves this with the unstable `rustc_layout_scalar_valid_range_*` attributes. + > `rustc` achieves this with pattern types (which are unstable). r[undefined.validity.const-provenance] * **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.