mirror of
https://github.com/apple/swift.git
synced 2026-10-30 22:15:52 +01:00
visitOnStackLifetimeEnds missed the lifetime end of an on-stack closure that was consumed indirectly. When a reabstraction thunk captured an exactly-once or at-most-once closure, the apply consuming the thunk wasn't recognized as the captured closure's lifetime end, which crashed with "found no consuming operand". When such a closure was passed to the consuming parameter of an inlined function, it was moved into the parameter's stack slot, which hit the "partial_apply [on_stack] must be directly forwarded to a destroy_value" fatal error. Follow the closure into the closures that capture it, through move_value, and through stack slots that hold nothing but the closure, including the slots that it's moved into. Accept a destroy_addr of such a slot as the end of the borrow scope that the closure introduces for its captures. Resolves rdar://190773089 and rdar://190773327.