How can I use region-based isolation?

What you have shown here is a result of us not having changed apis yet to take a transferring non-Sendable closure since transferring has not finished going through evolution. As a quick example of this in action, consider the following:

class NonSendable { }

extension Task where Failure == Never {
  // Modified Task.init() converting it to a non-Sendable transferring implementation.
  init(x: (), @_inheritActorContext @_implicitSelfCapture operation: transferring @escaping () async -> Success) {
    /* ... */
  }
}

func spawn() {
    let ns = NonSendable()
    Task.init(x: ()) {
        _ = ns
    }
}
6 Likes