-
Couldn't load subscription status.
- Fork 10.6k
Description
Description
While implementing the Data.mutableSpan property (swiftlang/swift-foundation#1276), I tried to compose mutableSpan around the existing implementation of mutableBytes, and return a typed view. However, using the mutableBytes accessor within the mutableSpan accessor causes an exclusivity check to fail.
Reproduction
In swiftlang/swift-foundation#1276 , when changing the conditional compilation condition of the mutableSpan accessor (data.swift, line 2272) to true, an exclusivity check fails with the message:
"Overlapping accesses to 'self', but modification requires exclusive access; consider copying to a local variable."
The alternative implementation manually inlines the mutableBytes implementation, and that compiles successfully.
Expected behavior
Composing one accessor in terms of the other should work.
Environment
Toolchain built from top-of-tree, April 29th 2025.
Additional information
This issue was cloned by rdar://150396586