Skip to content

Build failure with swift-nightly-main: region-isolation errors in MultiProducerSingleConsumerAsyncChannel #418

@sebsto

Description

@sebsto

swift-async-algorithms 1.1.3 fails to compile with the current swift-nightly-main toolchain.

All errors are in MultiProducerSingleConsumerAsyncChannel+Internal.swift and look like this:

error: '$0.enqueueContinuation' cannot be returned
note: returning '$0.enqueueContinuation' risks concurrent access to 'inout sending' parameter '$0'
      as caller assumes '$0' and result can be sent to different isolation domains

Same pattern repeats for enqueueProducer, cancelProducer, finish, next, suspendNext, and cancelNext.

To reproduce:

docker run --rm swiftlang/swift:nightly-main-jammy \
  bash -cl "git clone https://github.com/apple/swift-async-algorithms.git && cd swift-async-algorithms && swift build"

Looks like the nightly compiler tightened region-isolation checks around values returned from Mutex.withLock closures that use inout sending parameters.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions