@@ -330,9 +330,10 @@ public struct UnsafeRawPointer: _Pointer {
330330 /// is undefined.
331331 ///
332332 /// Any instance of `T` within the re-bound region may be initialized or
333- /// uninitialized. If a given instance of `T` within the re-bound region
334- /// overlaps with previously uninitialized memory, it shall be considered
335- /// uninitialized when executing `body`.
333+ /// uninitialized. The memory underlying any individual instance of `T`
334+ /// must have the same initialization state (i.e. initialized or
335+ /// uninitialized.) Accessing a `T` whose underlying memory
336+ /// is in a mixed initialization state shall be undefined behaviour.
336337 ///
337338 /// The following example temporarily rebinds a raw memory pointer
338339 /// to `Int64`, then accesses a property on the signed integer.
@@ -351,6 +352,12 @@ public struct UnsafeRawPointer: _Pointer {
351352 /// That is, `Int(bitPattern: self) % MemoryLayout<T>.alignment`
352353 /// must equal zero.
353354 ///
355+ /// - Note: The region of memory starting at this pointer may have been
356+ /// bound to a type. If that is the case, then `T` must be
357+ /// layout compatible with the type to which the memory has been bound.
358+ /// This requirement does not apply if the region of memory
359+ /// has not been bound to any type.
360+ ///
354361 /// - Parameters:
355362 /// - type: The type to temporarily bind the memory referenced by this
356363 /// pointer. This pointer must be a multiple of this type's alignment.
@@ -763,9 +770,10 @@ public struct UnsafeMutableRawPointer: _Pointer {
763770 /// is undefined.
764771 ///
765772 /// Any instance of `T` within the re-bound region may be initialized or
766- /// uninitialized. If a given instance of `T` within the re-bound region
767- /// overlaps with previously uninitialized memory, it shall be considered
768- /// uninitialized when executing `body`.
773+ /// uninitialized. The memory underlying any individual instance of `T`
774+ /// must have the same initialization state (i.e. initialized or
775+ /// uninitialized.) Accessing a `T` whose underlying memory
776+ /// is in a mixed initialization state shall be undefined behaviour.
769777 ///
770778 /// The following example temporarily rebinds a raw memory pointer
771779 /// to `Int64`, then modifies the signed integer.
@@ -783,6 +791,12 @@ public struct UnsafeMutableRawPointer: _Pointer {
783791 /// That is, `Int(bitPattern: self) % MemoryLayout<T>.alignment`
784792 /// must equal zero.
785793 ///
794+ /// - Note: The region of memory starting at this pointer may have been
795+ /// bound to a type. If that is the case, then `T` must be
796+ /// layout compatible with the type to which the memory has been bound.
797+ /// This requirement does not apply if the region of memory
798+ /// has not been bound to any type.
799+ ///
786800 /// - Parameters:
787801 /// - type: The type to temporarily bind the memory referenced by this
788802 /// pointer. This pointer must be a multiple of this type's alignment.
0 commit comments