Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 90752f9

Browse files
committedMar 29, 2025·
Revert "[temporary] disable spans over inline elements"
This reverts commit e5c7dfc.
1 parent 73d86a3 commit 90752f9

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed
 

‎stdlib/public/core/CollectionOfOne.swift

+3-1
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,9 @@ extension CollectionOfOne {
166166
@lifetime(borrow self)
167167
@_alwaysEmitIntoClient
168168
get {
169-
fatalError("Span over CollectionOfOne is not supported yet.")
169+
let pointer = unsafe UnsafePointer<Element>(Builtin.addressOfBorrow(self))
170+
let span = unsafe Span(_unsafeStart: pointer, count: 1)
171+
return unsafe _overrideLifetime(span, borrowing: self)
170172
}
171173
}
172174
}

‎stdlib/public/core/InlineArray.swift

+3-1
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,9 @@ extension InlineArray where Element: ~Copyable {
468468
@lifetime(borrow self)
469469
@_alwaysEmitIntoClient
470470
borrowing get {
471-
fatalError("Span over InlineArray is not supported yet.")
471+
let pointer = _address
472+
let span = unsafe Span(_unsafeStart: pointer, count: count)
473+
return unsafe _overrideLifetime(span, borrowing: self)
472474
}
473475
}
474476
}

0 commit comments

Comments
 (0)
Please sign in to comment.