Why does assumeIsolated() now require T: Sendable?

I wouldn't say “here to stay” — we're certainly always interested in finding ways to remove false positives. Both of these warnings are expected, though. The problem in both of your test cases is that we can transfer closure into the closure that captures it, but we can't allow it to be transferred out of that closure. This is for the simple reason that we don't know how often the closure is called: if it's called a second time, the captures still need to exist without having been transferred away. So to remove these false positives, we would need withUnsafeContinuation to declare that its parameter function is only called once. (schedule would also need to adopt that to make the second example work.)

3 Likes