Skip to content

Commit 073d545

Browse files
committed
[test] Sendability of MutableSpan
1 parent a5fa3ed commit 073d545

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

test/stdlib/Span/MutableSpanTests.swift

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -630,3 +630,18 @@ suite.test("MutableSpan from UnsafeMutableBufferPointer")
630630

631631
expectTrue(b.elementsEqual((0..<capacity).reversed()))
632632
}
633+
634+
private func send(_: borrowing some Sendable & ~Copyable & ~Escapable) {}
635+
636+
private struct NCSendable: ~Copyable, Sendable {}
637+
638+
suite.test("MutableSpan Sendability")
639+
.require(.stdlib_6_2).code {
640+
let buffer = UnsafeMutableBufferPointer<NCSendable>.allocate(capacity: 1)
641+
defer { buffer.deallocate() }
642+
buffer.initializeElement(at: 0, to: NCSendable())
643+
defer { buffer.deinitialize() }
644+
645+
let span = MutableSpan(_unsafeElements: buffer)
646+
send(span)
647+
}

0 commit comments

Comments
 (0)