Files
swift-mirror/SwiftCompilerSources/Sources/Optimizer/FunctionPasses/LifetimeDependenceDiagnostics.swift
Andrew Trick ac94d7df1d Fix LifetimeDependenceDiagnostics: allow inout assignment to Void.
Bypess lifetime dependence diagnostics completely for immortal values. We did
not do this initially because we wanted to potentially consider a value with a missing
dependency to mean that it could not escape the current function. But now we use
`Void` as a stand-in for immortal values.

This is needed for reassigning a Span/MutableSpan to an empty, immortal
Span:

    func inoutToImmortal(_ s: inout RawSpan) {
      let tmp = RawSpan(_unsafeBytes: UnsafeRawBufferPointer(start: nil, count: 0))
      s = _overrideLifetime(tmp, borrowing: ())
    }

Fixes rdar://152572002 ([GH:#81976] Cannot reinitialize inout parameter of type
`MutableSpan<T>?`)
2025-07-07 00:16:49 -07:00

23 KiB