@@ -42,15 +42,15 @@ code.
4242 * A null ` fn ` pointer.
4343 * A value in a ` char ` which is a surrogate or above ` char::MAX ` .
4444 * A ` ! ` (all values are invalid for this type).
45+ * [ Uninitialized memory] [ undef ] in the value of an integer (` i* ` /` u* ` ),
46+ floating point value (` f* ` ), or raw pointer.
4547 * A dangling or unaligned reference or ` Box ` , or one that points to an invalid value.
46- * Invalid metadata in a wide reference, ` Box ` or raw pointer:
47- * slice metadata is invalid if the slice has a total size larger than
48- ` isize::MAX ` bytes in memory.
48+ * Invalid metadata in a wide reference, ` Box ` , or raw pointer:
4949 * ` dyn Trait ` metadata is invalid if it is not a pointer to a vtable for
5050 ` Trait ` that matches the actual dynamic trait the reference points to.
51+ * Slice metadata is invalid if if the length is not a valid ` usize `
52+ (i.e., it must not be read from uninitialized memory).
5153 * Non-UTF-8 byte sequences in a ` str ` .
52- * [ Uninitialized memory] [ undef ] in the value of an integer (` i* ` /` u* ` ),
53- floating point value (` f* ` ), or raw pointer.
5454 * Invalid values for a type with a custom definition of invalid values, such
5555 as a ` NonNull ` that is null. (Requesting custom invalid values is an
5656 unstable feature, but some stable libstd types, like ` NonNull ` , make use of
@@ -68,7 +68,8 @@ part of *some* allocation). The span of bytes it points to is determined by the
6868pointer value and the size of the pointee type. As a consequence, if the span is
6969empty, "dangling" is the same as "non-null". Note that slices point to their
7070entire range, so it is very important that the length metadata is never too
71- large.
71+ large. In particular, allocations and therefore slices cannot be bigger than
72+ ` isize::MAX ` bytes.
7273
7374[ noalias ] : http://llvm.org/docs/LangRef.html#noalias
7475[ pointer aliasing rules ] : http://llvm.org/docs/LangRef.html#pointer-aliasing-rules
0 commit comments