Skip to content

Explicitly mark the AsyncSequence iterators as non Sendable #490

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import PackageDescription

let swiftSettings: [SwiftSetting] = [
.enableUpcomingFeature("StrictConcurrency")
.enableUpcomingFeature("StrictConcurrency"),
]

let package = Package(
Expand Down
3 changes: 3 additions & 0 deletions Sources/PostgresNIO/New/PostgresNotificationSequence.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,6 @@ public struct PostgresNotificationSequence: AsyncSequence, Sendable {
}
}
}

@available(*, unavailable)
extension PostgresNotificationSequence.AsyncIterator: Sendable {}
2 changes: 1 addition & 1 deletion Sources/PostgresNIO/New/PostgresQuery.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ extension PostgresQuery: ExpressibleByStringInterpolation {
}

extension PostgresQuery {
public struct StringInterpolation: StringInterpolationProtocol {
public struct StringInterpolation: StringInterpolationProtocol, Sendable {
public typealias StringLiteralType = String

@usableFromInline
Expand Down
5 changes: 4 additions & 1 deletion Sources/PostgresNIO/New/PostgresRowSequence.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import NIOConcurrencyHelpers
/// An async sequence of ``PostgresRow``s.
///
/// - Note: This is a struct to allow us to move to a move only type easily once they become available.
public struct PostgresRowSequence: AsyncSequence {
public struct PostgresRowSequence: AsyncSequence, Sendable {
public typealias Element = PostgresRow

typealias BackingSequence = NIOThrowingAsyncSequenceProducer<DataRow, Error, AdaptiveRowBuffer, PSQLRowStream>
Expand Down Expand Up @@ -56,6 +56,9 @@ extension PostgresRowSequence {
}
}

@available(*, unavailable)
extension PostgresRowSequence.AsyncIterator: Sendable {}

extension PostgresRowSequence {
public func collect() async throws -> [PostgresRow] {
var result = [PostgresRow]()
Expand Down
Loading