@@ -330,9 +330,10 @@ public struct UnsafeRawPointer: _Pointer {
330
330
/// is undefined.
331
331
///
332
332
/// 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.
336
337
///
337
338
/// The following example temporarily rebinds a raw memory pointer
338
339
/// to `Int64`, then accesses a property on the signed integer.
@@ -351,6 +352,12 @@ public struct UnsafeRawPointer: _Pointer {
351
352
/// That is, `Int(bitPattern: self) % MemoryLayout<T>.alignment`
352
353
/// must equal zero.
353
354
///
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
+ ///
354
361
/// - Parameters:
355
362
/// - type: The type to temporarily bind the memory referenced by this
356
363
/// pointer. This pointer must be a multiple of this type's alignment.
@@ -763,9 +770,10 @@ public struct UnsafeMutableRawPointer: _Pointer {
763
770
/// is undefined.
764
771
///
765
772
/// 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.
769
777
///
770
778
/// The following example temporarily rebinds a raw memory pointer
771
779
/// to `Int64`, then modifies the signed integer.
@@ -783,6 +791,12 @@ public struct UnsafeMutableRawPointer: _Pointer {
783
791
/// That is, `Int(bitPattern: self) % MemoryLayout<T>.alignment`
784
792
/// must equal zero.
785
793
///
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
+ ///
786
800
/// - Parameters:
787
801
/// - type: The type to temporarily bind the memory referenced by this
788
802
/// pointer. This pointer must be a multiple of this type's alignment.
0 commit comments