Audit pass on Sendable conformances and requirements (#272)

* Audit pass on Sendable conformances and requirements

* A slightly cleaner mark for Sendability of OrderedSet

* Remove flags for strict mode
This commit is contained in:
Philippe Hausler authored and GitHub committed 2023-06-23 14:21:34 -07:00
1 parent 156bb4bf49
commit a42b72ad84
7 files changed
+19 -10

No files matched your search

@@ -10,8 +10,11 @@
//===----------------------------------------------------------------------===//
@_implementationOnly import OrderedCollections
struct ChannelStateMachine<Element, Failure: Error>: Sendable {
private struct SuspendedProducer: Hashable {
// NOTE: this is only marked as unchecked since the swift-collections tag is before auditing for Sendable
extension OrderedSet: @unchecked Sendable where Element: Sendable { }
struct ChannelStateMachine<Element: Sendable, Failure: Error>: Sendable {
private struct SuspendedProducer: Hashable, Sendable {
let id: UInt64
let continuation: UnsafeContinuation<Void, Never>?
let element: Element?
@@ -29,7 +32,7 @@ struct ChannelStateMachine<Element, Failure: Error>: Sendable {
}
}
private struct SuspendedConsumer: Hashable {
private struct SuspendedConsumer: Hashable, Sendable {
let id: UInt64
let continuation: UnsafeContinuation<Element?, any Error>?
@@ -51,7 +54,7 @@ struct ChannelStateMachine<Element, Failure: Error>: Sendable {
case failed(Error)
}
private enum State {
private enum State: Sendable {
case channeling(
suspendedProducers: OrderedSet<SuspendedProducer>,
cancelledProducers: Set<SuspendedProducer>,