mirror of
https://github.com/apple/swift-collections
synced 2026-11-23 04:24:23 +00:00
RigidArray's _customConsumeLast(_:) hook called consumeLast(_:), but RigidArray has no one-argument consumeLast of its own, so the call went to DrainableContainer.consumeLast(_:), which starts by calling the hook. Every call to consumeLast(_:) on a RigidArray, directly or through generic code, recursed until the stack overflowed. Have the hook check the count and return consumeSubrange(_:) over the last n items directly, the way consumeLast(_:consumingWith:) does. Fixes #814. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>