Closed
Description
Description
In https://forums.swift.org/t/80854/4, @benrimmington asked an implementation question:
I'm not sure what happens to _start() when the span is empty.
extension MutableSpan where Element: ~Copyable {
@lifetime(&self)
mutating public func extracting(_: UnboundedRange) -> Self {
let newSpan = unsafe Self(_unchecked: _start(), count: _count)
return unsafe _overrideLifetime(newSpan, mutating: &self)
}
}
The answer is probably nothing good. This is an error in the implementation.
Expected behavior
There shouldn't be an unsafe unwrap in this code path.
Environment
swift-DEVELOPMENT-SNAPSHOT-2025-06-22-a
Additional information
Also tracked in rdar://155198823