@@ -71,12 +71,13 @@ Please read the [Rustonomicon] before writing unsafe code.
71
71
* A ` ! ` (all values are invalid for this type).
72
72
* An integer (` i* ` /` u* ` ), floating point value (` f* ` ), or raw pointer obtained
73
73
from [ uninitialized memory] [ undef ] , or uninitialized memory in a ` str ` .
74
- * A reference or ` Box<T> ` that is [ dangling] , misaligned, or points to an invalid value.
74
+ * A reference or ` Box<T> ` that is [ dangling] , misaligned, or points to an invalid value
75
+ (using the actual dynamic type of the pointee as determined by the vtable in
76
+ the metadata in case of dynamically sized types).
75
77
* Invalid metadata in a wide reference, ` Box<T> ` , or raw pointer. The requirement
76
78
for the metadata is determined by the type of the unsized tail:
77
- * ` dyn Trait ` metadata is invalid if it is not a pointer to a vtable for
78
- ` Trait ` that matches the actual dynamic trait the pointer or reference points to.
79
- * Slice metadata is invalid if the length is not a valid ` usize `
79
+ * ` dyn Trait ` metadata is invalid if it is not a pointer to a vtable for ` Trait ` .
80
+ * Slice (` [T] ` ) metadata is invalid if the length is not a valid ` usize `
80
81
(i.e., it must not be read from uninitialized memory).
81
82
Furthermore, for wide references and ` Box<T> ` , slice metadata is invalid
82
83
if it makes the total size of the pointed-to value bigger than ` isize::MAX ` .
0 commit comments