apple / swift-async-algorithms

Async Algorithms for Swift
Apache License 2.0
2.95k stars 147 forks source link

Fix some strict concurrency warnings #310

Closed FranzBusch closed 6 months ago

FranzBusch commented 6 months ago

Motivation

There were a few new strict concurrency warnings that this PR fixes.

FranzBusch commented 6 months ago

@swift-ci please test

FranzBusch commented 6 months ago

I presume if there is then later a transfer keyword we will likely migrate to that eh?

Sadly we can't since the elements are returned from an iterator. The next method is not marked as transferring the return element so we can't forward transfer it. However, what we are doing here is safe since the elements are never owned by more than one task.