We're seeing an issue in Vapor when compiling it with the tools version set to 6.0 and the language mode set to .v6 in that it's failing to compile because of a Sendable warning in a dependency (Swift Metrics). This dependency is currently on 5.6 so should be built in Swift 5 language mode correct?
It may be worth trying to reproduce this problem with a command line only build without Xcode or xcodebuild involved.
Xcode 16 beta 1's behavior currently differs from swift in how default languge mode is set. I don't immediately see how that would cause the problem you are seeing happen. But, it at least does sound like it could be related.
377 | public struct TimeUnit: Equatable {
| `- note: consider making struct 'TimeUnit' conform to the 'Sendable' protocol
378 | private enum Code: Equatable {
379 | case nanoseconds
:
399 | public static let microseconds = TimeUnit(code: .microseconds, scaleFromNanoseconds: 1000)
400 | public static let milliseconds = TimeUnit(code: .milliseconds, scaleFromNanoseconds: 1000 * TimeUnit.microseconds.scaleFromNanoseconds)
401 | public static let seconds = TimeUnit(code: .seconds, scaleFromNanoseconds: 1000 * TimeUnit.milliseconds.scaleFromNanoseconds)
| |- error: static property 'seconds' is not concurrency-safe because non-'Sendable' type 'TimeUnit' may have shared mutable state
| |- note: annotate 'seconds' with '@MainActor' if property should only be accessed from the main actor
| `- note: disable concurrency-safety checks if accesses are protected by an external synchronization mechanism
402 | public static let minutes = TimeUnit(code: .minutes, scaleFromNanoseconds: 60 * TimeUnit.seconds.scaleFromNanoseconds)
403 | public static let hours = TimeUnit(code: .hours, scaleFromNanoseconds: 60 * TimeUnit.minutes.scaleFromNanoseconds)
/Users/timc/Developer/Vapor/vapor/.build/checkouts/swift-metrics/Sources/CoreMetrics/Metrics.swift:401:23: error: static property 'seconds' is not concurrency-safe because non-'Sendable' type 'TimeUnit' may have shared mutable state
Note that the type and declaration producing the error are in a dependency
I spent some time investigating this and turns out this is not a SwiftPM issue but a compiler one. The diagnostic points to the declaration of the seconds but it should actually be pointing to the point-of-use in this case. I'll working on a fix for this and will update this thread once that's done.
This might explain why we’ve seen an increase in error counts in our “Ready for Swift 6” graph for the Xcode 16b1 build. We’d be counting root dependencies’ errors multiple times.
Final one - without meaning to highjack the thread - is InferSendableFromCaptures implemented in the current Swift 6 toolchain? We're seeing an error with code like
I'm not sure what you mean here, the contextual type here is not parked as Sendable which overrides any inference we apply to the literal because that's the type we covert to.