swiftlang / swiftlang/swift-experimental-string-processing
Regex is not Sendable
Nobody has claimed this yet.
- Dominant language
- Swift
- Stars
- 308
- Forks
- 52
- Avg merge
- 12h 45m
- Merged PRs (30d)
- 2
Description
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the provided Parser reproduction under Swift 6 and inspect how Regex is represented and checked for Sendable conformance. Done means the shown static Regex declaration compiles without a Sendable diagnostic while preserving the expected regex behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- swift
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100