Skip to content

Regex is not Sendable #792

Open
Open
@svanimpe

Description

@svanimpe

Description

I was surprised to learn that Regex is not Sendable. The code below doesn't compile with Swift 6.

Reproduction

struct Parser {
    private static let number = /\d+/
}

Expected behavior

I would expect this to just work. Regex is a value type. Why would it have shared mutable state?

Environment

swift-driver version: 1.115 Apple Swift version 6.0.2 (swiftlang-6.0.2.1.2 clang-1600.0.26.4)
Target: x86_64-apple-macosx15.0

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions