Skip to content

Commit f2e1370

Browse files
committed
Work around compiler assertion failure
Work around swiftlang/swift#83309
1 parent 8ea9b21 commit f2e1370

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
@@ -130,7 +130,17 @@ public struct PostgresBinaryCopyFromWriter: ~Copyable {
130130
@inlinable
131131
public mutating func writeColumn(_ column: (some PostgresEncodable)?) throws {
132132
columns += 1
133-
try underlying.pointee.writeColumn(column)
133+
try invokeWriteColumn(on: underlying, column)
134+
}
135+
136+
// Needed to work around https://github.com/swiftlang/swift/issues/83309, copying the implementation into
137+
// `writeColumn` causes an assertion failure when thread sanitizer is enabled.
138+
@inlinable
139+
func invokeWriteColumn(
140+
on writer: UnsafeMutablePointer<PostgresBinaryCopyFromWriter>,
141+
_ column: (some PostgresEncodable)?
142+
) throws {
143+
try writer.pointee.writeColumn(column)
134144
}
135145
}
136146

0 commit comments

Comments
 (0)