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

chore(deps): update dependency swiftlang/swift to v5.10.1 #3905

Merged
merged 1 commit into from
Oct 7, 2024

Conversation

renovate[bot]
Copy link
Contributor

@renovate renovate bot commented Oct 7, 2024

This PR contains the following updates:

Package Update Change
swiftlang/swift minor 5.9 -> 5.10.1

Warning

Some dependencies could not be looked up. Check the Dependency Dashboard for more information.


Release Notes

swiftlang/swift (swiftlang/swift)

v5.10.1: Swift 5.10.1 Release

Compare Source

v5.10

Compare Source

2024-03-05 (Xcode 15.3)
  • Swift 5.10 closes all known static data-race safety holes in complete strict
    concurrency checking.

    When writing code against -strict-concurrency=complete, Swift 5.10 will
    diagnose all potential for data races at compile time unless an explicit
    unsafe opt out, such as nonisolated(unsafe) or @unchecked Sendable, is
    used.

    For example, in Swift 5.9, the following code crashes at runtime due to a
    @MainActor-isolated initializer being evaluated outside the actor, but it
    was not diagnosed under -strict-concurrency=complete:

    @​MainActor
    class MyModel {
      init() {
        MainActor.assertIsolated()
      }
    
      static let shared = MyModel()
    }
    
    func useShared() async {
      let model = MyModel.shared
    }
    
    await useShared()

    The above code admits data races because a @MainActor-isolated static
    variable, which evaluates a @MainActor-isolated initial value upon first
    access, is accessed synchronously from a nonisolated context. In Swift
    5.10, compiling the code with -strict-concurrency=complete produces a
    warning that the access must be done asynchronously:

    warning: expression is 'async' but is not marked with 'await'
      let model = MyModel.shared
                  ^~~~~~~~~~~~~~
                  await
    

    Swift 5.10 fixed numerous other bugs in Sendable and actor isolation
    checking to strengthen the guarantees of complete concurrency checking.

    Note that the complete concurrency model in Swift 5.10 is conservative.
    Several Swift Evolution proposals are in active development to improve the
    usability of strict concurrency checking ahead of Swift 6.

  • [SE-0412][]:

    Global and static variables are prone to data races because they provide memory that can be accessed from any program context. Strict concurrency checking in Swift 5.10 prevents data races on global and static variables by requiring them to be either:

    1. isolated to a global actor, or
    2. immutable and of Sendable type.

    For example:

    var mutableGlobal = 1
    // warning: var 'mutableGlobal' is not concurrency-safe because it is non-isolated global shared mutable state
    // (unless it is top-level code which implicitly isolates to @​MainActor)
    
    @​MainActor func mutateGlobalFromMain() {
      mutableGlobal += 1
    }
    
    nonisolated func mutateGlobalFromNonisolated() async {
      mutableGlobal += 10
    }
    
    struct S {
      static let immutableSendable = 10
      // okay; 'immutableSendable' is safe to access concurrently because it's immutable and 'Int' is 'Sendable'
    }

    A new nonisolated(unsafe) modifier can be used to annotate a global or static variable to suppress data isolation violations when manual synchronization is provided:

    // This global is only set in one part of the program
    nonisolated(unsafe) var global: String!

    nonisolated(unsafe) can be used on any form of storage, including stored properties and local variables, as a more granular opt out for Sendable checking, eliminating the need for @unchecked Sendable wrapper types in many use cases:

    import Dispatch
    
    // 'MutableData' is not 'Sendable'
    class MutableData { ... } 
    
    final class MyModel: Sendable {
      private let queue = DispatchQueue(...)
      // 'protectedState' is manually isolated by 'queue'
      nonisolated(unsafe) private var protectedState: MutableData
    }

    Note that without correct implementation of a synchronization mechanism to achieve data isolation, dynamic run-time analysis from exclusivity enforcement or tools such as the Thread Sanitizer could still identify failures.

  • [SE-0411][]:

    Swift 5.10 closes a data-race safety hole that previously permitted isolated
    default stored property values to be synchronously evaluated from outside the
    actor. For example, the following code compiles warning-free under
    -strict-concurrency=complete in Swift 5.9, but it will crash at runtime at
    the call to MainActor.assertIsolated():

    @​MainActor func requiresMainActor() -> Int {
      MainActor.assertIsolated()
      return 0
    }
    
    @​MainActor struct S {
      var x = requiresMainActor()
      var y: Int
    }
    
    nonisolated func call() async {
      let s = await S(y: 10)
    }
    
    await call()

    This happens because requiresMainActor() is used as a default argument to
    the member-wise initializer of S, but default arguments are always
    evaluated in the caller. In this case, the caller runs on the generic
    executor, so the default argument evaluation crashes.

    Under -strict-concurrency=complete in Swift 5.10, default argument values
    can safely share the same isolation as the enclosing function or stored
    property. The above code is still valid, but the isolated default argument is
    guaranteed to be evaluated in the callee's isolation domain.

v5.9.2

Compare Source

2023-12-11 (Xcode 15.1)
  • [SE-0407][]:

    Member macros can specify a list of protocols via the conformances argument to the macro role. The macro implementation will be provided with those protocols that are listed but have not already been implemented by the type to which the member macro is attached, in the same manner as extension macros.

    @​attached(member, conformances: Decodable, Encodable, names: named(init(from:), encode(to:)))
    @​attached(extension, conformances: Decodable, Encodable, names: named(init(from:), encode(to:)))
    macro Codable() = #externalMacro(module: "MyMacros", type: "CodableMacro")

v5.9.1: Swift 5.9.1 Release

Compare Source


Configuration

📅 Schedule: Branch creation - "after 4pm on friday,before 9am on monday,every weekend" in timezone Europe/Paris, Automerge - At any time (no schedule defined).

🚦 Automerge: Enabled.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

@renovate renovate bot requested a review from a team as a code owner October 7, 2024 10:28
@renovate renovate bot requested review from morganleroi and millotp and removed request for a team October 7, 2024 10:28
@algolia-bot
Copy link
Collaborator

algolia-bot commented Oct 7, 2024

✔️ Code generated!

Name Link
🪓 Triggered by cdd3c0f4dacec938340ad3d4f733b2c09b3d5dad
🍃 Generated commit 21c1a7054854d8d15684b41e4ff85639eeb3c483
🌲 Generated branch generated/renovate/swiftlang-swift-5.x
📊 Benchmark results

Benchmarks performed on the method using a mock server, the results might not reflect the real-world performance.

Language Req/s
swift 733

@renovate renovate bot force-pushed the renovate/swiftlang-swift-5.x branch from baa3d29 to 103e379 Compare October 7, 2024 11:18
@renovate renovate bot force-pushed the renovate/swiftlang-swift-5.x branch from 103e379 to 68cfeb3 Compare October 7, 2024 11:24
@shortcuts shortcuts merged commit 7fe31d5 into chore/renovateBaseBranch Oct 7, 2024
12 checks passed
@shortcuts shortcuts deleted the renovate/swiftlang-swift-5.x branch October 7, 2024 11:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants