Merge pull request #81223 from atrick/62-missing-markdep

[6.2] Fix LifetimeDependenceInsertion: handle boxed indirect out arguments
This commit is contained in:
Andrew Trick
2025-05-01 00:51:13 -07:00
committed by GitHub
3 changed files with 47 additions and 7 deletions

View File

@@ -69,13 +69,17 @@ public func consumeAndCreate(_ view: consuming BufferView) -> BufferView {
return _overrideLifetime(bv, copying: view)
}
// FIXME: Filed rdar://150398673 ([nonescapable] allocbox-to-stack fails causing lifetime diagnostics to fail)
// Remove _overrideLifetime when this is fixed.
@inlinable
@lifetime(copy this, copy that)
public func deriveThisOrThat(_ this: consuming BufferView, _ that: consuming BufferView) -> BufferView {
if (Int.random(in: 1..<100) == 0) {
return BufferView(this._ptr, this._count)
let thisView = BufferView(this._ptr, this._count)
return _overrideLifetime(thisView, copying: this)
}
return BufferView(that._ptr, that._count)
let thatView = BufferView(that._ptr, that._count)
return _overrideLifetime(thatView, copying: that)
}
public struct Container {