Skip to content

Commit cbcef93

Browse files
authored
Merge pull request swiftlang#84002 from stephentyrone/pointer-comment-clarification
Remove "if and only if" language from [Raw]Span's _pointer field
2 parents 385938f + 567c619 commit cbcef93

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

stdlib/public/core/Span/RawSpan.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ public struct RawSpan: ~Escapable, Copyable, BitwiseCopyable {
3030

3131
/// The starting address of this `RawSpan`.
3232
///
33-
/// `_pointer` can be `nil` if and only if `_count` equals 0.
34-
/// Otherwise, `_pointer` must point to memory that will remain
35-
/// valid and not mutated as long as this `Span` exists.
36-
/// The memory at `_pointer` must consist of `_count` initialized bytes.
33+
/// If `_count` is zero, `_pointer` may point to valid memory or it may be `nil`,
34+
/// but no accesses may be performed through it. Otherwise, `_pointer` must point
35+
/// to initialized memory containing `_count` bytes, which must remain valid and
36+
/// not be mutated during the lifetime of this `RawSpan`.
3737
@usableFromInline
3838
internal let _pointer: UnsafeRawPointer?
3939

stdlib/public/core/Span/Span.swift

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,10 @@ public struct Span<Element: ~Copyable>: ~Escapable, Copyable, BitwiseCopyable {
3030

3131
/// The starting address of this `Span`.
3232
///
33-
/// `_pointer` can be `nil` if and only if `_count` equals 0.
34-
/// Otherwise, `_pointer` must point to memory that will remain
35-
/// valid and not mutated as long as this `Span` exists.
36-
/// The memory at `_pointer` must be initialized
37-
/// as `_count` instances of `Element`.
33+
/// If `_count` is zero, `_pointer` may point to valid memory or it may be `nil`,
34+
/// but no accesses may be performed through it. Otherwise, `_pointer` must point
35+
/// to initialized memory containing `_count` instances of `Element`, which must
36+
/// remain valid and not be mutated during the lifetime of this `Span`.
3837
@usableFromInline
3938
internal let _pointer: UnsafeRawPointer?
4039

0 commit comments

Comments
 (0)