Hi, I was tracing down some performance deviation between an algorithm implemented in Rust and Swift. Initially the rust implementation was faster, I traced that down to various runtime checks and switched my array to a unique array. But range checks were not elided seemingly because the count is not assumed non-negative like capacity is.
Flagging it here in case someone want to weigh in if this is a bug or not, I can raise an issue if it is.
I think you're on point.
I'd wrap this _count in here, in _assumeNonNegative:
I can run the CI etc... if you'd like to PR this to the repository and mention it here (disclaimer I'm not part of the Swift team so they'll have to approve as well).
If you don't feel comfortable enough, I can PR it instead.
I'm not sure if swift-collections where UniqueArray and RigidArray originate from would like to keep these in sync as well or not. @lorentey would know.