Skip to content

Commit 8bbbfa3

Browse files
committed
avoid unchecked Sendable
1 parent 438a7b6 commit 8bbbfa3

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

Sources/Tracing/Span.swift

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15-
import Dispatch
15+
@preconcurrency import struct Dispatch.DispatchWallTime
1616
@_exported import InstrumentationBaggage
1717

1818
/// A `Span` represents an interval from the start of an operation to its end, along with additional metadata included
@@ -233,8 +233,13 @@ public enum SpanAttribute: Equatable {
233233
case string(String)
234234
case stringArray([String])
235235

236+
#if swift(>=5.6)
237+
case stringConvertible(CustomStringConvertible & Sendable)
238+
case stringConvertibleArray([CustomStringConvertible & Sendable])
239+
#else
236240
case stringConvertible(CustomStringConvertible)
237241
case stringConvertibleArray([CustomStringConvertible])
242+
#endif
238243

239244
#if swift(>=5.2)
240245
// older swifts get confused and can't resolve if we mean the `case int(Int64)` or any of those overloads
@@ -666,9 +671,9 @@ public protocol _SwiftTracingSendableSpan {}
666671

667672
#if compiler(>=5.6)
668673
extension SpanAttributes: Sendable {}
669-
extension SpanAttribute: @unchecked Sendable {}
674+
extension SpanAttribute: Sendable {} // @unchecked because some payloads are CustomStringConvertible
670675
extension SpanStatus: Sendable {}
671-
extension SpanEvent: @unchecked Sendable {} // unchecked because of DispatchWallTime
676+
extension SpanEvent: Sendable {}
672677
extension SpanKind: Sendable {}
673678
extension SpanStatus.Code: Sendable {}
674679
extension SpanLink: Sendable {}

0 commit comments

Comments
 (0)