Is adding a `Sendable` requirement a breaking change?

Thanks for the reply.

Is this from the discussion of SE-0337 still accurate?

(sorry I haven't checked, I've been out for an extended period).

it’s not like i seriously expected this to work in the first place, but no, you cannot @preconcurrency import Swift in order to suppress Sendable warnings within the standard library itself.

@preconcurrency import Swift

var arguments:IndexingIterator<[String]> = 
    Swift.CommandLine.arguments.makeIterator()
// reference to static property 'arguments' is not concurrency-safe 
// because it involves shared mutable state

the great irony of this bug is it actually forces you to use unsafe constructs completely unnecessarily:

let commandLineArgs:[String] = UnsafeBufferPointer<UnsafeMutablePointer<CChar>?>.init(
  start: CommandLine.unsafeArgv,
  count: Int.init(CommandLine.argc)).lazy
  .compactMap { $0 }
  .compactMap { String.init(validatingUTF8: $0) }
1 Like