mirror of
https://github.com/apple/swift-collections
synced 2026-11-24 04:27:53 +00:00
A non-unique reference to a storage instance can legitimately become unique at any point, due to other references (say, held, by another thread) getting destroyed. `Deque`’s `ensureUnique` implementation currently invokes the uniqueness check two times in quick succession, expecting it to return false both times. In rare circumstances, this can lead to a spurious trap in concurrent environments. Fix this by avoiding calling `isUnique` more than once.