Skip to content

Commit e9caab1

Browse files
committed
Revert "[temporary] disable spans over inline elements"
This reverts commit e5c7dfc.
1 parent a3290b5 commit e9caab1

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

Diff for: 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
}

Diff for: 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)