Skip to content
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

[sendable] Sendable conformance checks cause errors on 5.6 but warnings on 5.7 #229

Merged
merged 2 commits into from
Aug 15, 2022
Merged
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
9 changes: 7 additions & 2 deletions Sources/Logging/Logging.swift
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,7 @@ extension Logger {
case string(String)

/// A metadata value which is some `CustomStringConvertible`.
#if compiler(>=5.6)
#if compiler(>=5.7)
case stringConvertible(CustomStringConvertible & Sendable)
#else
case stringConvertible(CustomStringConvertible)
Expand Down Expand Up @@ -1276,9 +1276,14 @@ extension Logger.MetadataValue: ExpressibleByArrayLiteral {

// MARK: - Sendable support helpers

#if compiler(>=5.7.0)
extension Logger.MetadataValue: Sendable {} // on 5.7 `stringConvertible`'s value marked as Sendable; but if a value not conforming to Sendable is passed there, a warning is emitted. We are okay with warnings, but on 5.6 for the same situation an error is emitted (!)
#elseif compiler(>=5.6)
extension Logger.MetadataValue: @unchecked Sendable {} // sadly, On 5.6 a missing Sendable conformance causes an 'error' (specifically this is about `stringConvertible`'s value)
#endif

#if compiler(>=5.6)
extension Logger: Sendable {}
extension Logger.MetadataValue: Sendable {}
extension Logger.Level: Sendable {}
extension Logger.Message: Sendable {}
#endif