Skip to content

Commit 6dd723c

Browse files
committed
Work around compiler assertion failure
Work around swiftlang/swift#83309
1 parent ca3f486 commit 6dd723c

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

Sources/PostgresNIO/Connection/PostgresConnection+CopyFrom.swift

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,17 @@ public struct PostgresBinaryCopyFromWriter: ~Copyable {
3232
@inlinable
3333
public mutating func writeColumn(_ column: (some PostgresEncodable)?) throws {
3434
columns += 1
35-
try underlying.pointee.writeColumn(column)
35+
try invokeWriteColumn(on: underlying, column)
36+
}
37+
38+
// Needed to work around https://github.com/swiftlang/swift/issues/83309, copying the implementation into
39+
// `writeColumn` causes an assertion failure when thread sanitizer is enabled.
40+
@inlinable
41+
func invokeWriteColumn(
42+
on writer: UnsafeMutablePointer<PostgresBinaryCopyFromWriter>,
43+
_ column: (some PostgresEncodable)?
44+
) throws {
45+
try writer.pointee.writeColumn(column)
3646
}
3747
}
3848

0 commit comments

Comments
 (0)